public class XMSSUtil
extends java.lang.Object
Constructor and Description |
---|
XMSSUtil() |
Modifier and Type | Method and Description |
---|---|
static long |
bytesToXBigEndian(byte[] in,
int offset,
int size)
Generic convert from big endian byte array to long.
|
static int |
calculateTau(int index,
int height) |
static byte[] |
cloneArray(byte[] in)
Clone a byte array.
|
static byte[][] |
cloneArray(byte[][] in)
Clone a 2d byte array.
|
static boolean |
compareByteArray(byte[][] a,
byte[][] b)
Compares two 2d-byte arrays.
|
static boolean |
compareByteArray(byte[] a,
byte[] b)
Compares two byte arrays.
|
static byte[] |
concat(byte[]... arrays)
Concatenates an arbitrary number of byte arrays.
|
static void |
copyBytesAtOffset(byte[] dst,
byte[] src,
int offset)
Copy src byte array to dst byte array at offset.
|
static java.lang.Object |
deserialize(byte[] data) |
static void |
dumpByteArray(byte[][] x)
Dump content of 2d byte array.
|
static byte[] |
extractBytesAtOffset(byte[] src,
int offset,
int length)
Copy length bytes at position offset from src.
|
static int |
getDigestSize(Digest digest)
Determine digest size of digest.
|
static int |
getLeafIndex(long index,
int xmssTreeHeight) |
static long |
getTreeIndex(long index,
int xmssTreeHeight) |
static boolean |
hasNullPointer(byte[][] in)
Checks whether 2d byte array has null pointers.
|
static void |
intToBytesBigEndianOffset(byte[] in,
int value,
int offset)
Copy int to byte array in big-endian at specific offset.
|
static boolean |
isIndexValid(int height,
long index)
Check whether an index is valid or not.
|
static boolean |
isNewAuthenticationPathNeeded(long globalIndex,
int xmssHeight,
int layer) |
static boolean |
isNewBDSInitNeeded(long globalIndex,
int xmssHeight,
int layer) |
static int |
log2(int n)
Calculates the logarithm base 2 for a given Integer.
|
static void |
longToBytesBigEndianOffset(byte[] in,
long value,
int offset)
Copy long to byte array in big-endian at specific offset.
|
static byte[] |
serialize(java.lang.Object obj) |
static byte[] |
toBytesBigEndian(long value,
int sizeInByte)
Convert int/long to n-byte array.
|
public static int log2(int n)
n
- Number.n
.public static byte[] toBytesBigEndian(long value, int sizeInByte)
value
- int/long value.sizeInByte
- Size of byte array in byte.sizeInByte
.public static void intToBytesBigEndianOffset(byte[] in, int value, int offset)
Byte
- array.Integer
- to put.Offset
- in in
.public static void longToBytesBigEndianOffset(byte[] in, long value, int offset)
Byte
- array.Long
- to put.Offset
- in in
.public static long bytesToXBigEndian(byte[] in, int offset, int size)
x-byte
- arrayoffset.
- size.
- public static byte[] cloneArray(byte[] in)
in
- byte array.public static byte[][] cloneArray(byte[][] in)
in
- 2d byte array.public static byte[] concat(byte[]... arrays)
arrays
- Arrays that shall be concatenated.public static boolean compareByteArray(byte[] a, byte[] b)
a
- byte array 1.b
- byte array 2.public static boolean compareByteArray(byte[][] a, byte[][] b)
a
- 2d-byte array 1.b
- 2d-byte array 2.public static void dumpByteArray(byte[][] x)
x
- byte array.public static boolean hasNullPointer(byte[][] in)
in
- 2d byte array.public static void copyBytesAtOffset(byte[] dst, byte[] src, int offset)
dst
- Destination.src
- Source.offset
- Destination offset.public static byte[] extractBytesAtOffset(byte[] src, int offset, int length)
src
- Source byte array.offset
- Offset in source byte array.length
- Length of bytes to copy.public static boolean isIndexValid(int height, long index)
height
- Height of binary tree.index
- Index to validate.public static int getDigestSize(Digest digest)
digest
- Digest.public static long getTreeIndex(long index, int xmssTreeHeight)
public static int getLeafIndex(long index, int xmssTreeHeight)
public static byte[] serialize(java.lang.Object obj) throws java.io.IOException
java.io.IOException
public static java.lang.Object deserialize(byte[] data) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public static int calculateTau(int index, int height)
public static boolean isNewBDSInitNeeded(long globalIndex, int xmssHeight, int layer)
public static boolean isNewAuthenticationPathNeeded(long globalIndex, int xmssHeight, int layer)