public class XMSSUtil
extends java.lang.Object
Constructor and Description |
---|
XMSSUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean |
areEqual(byte[][] a,
byte[][] b)
Compares two 2d-byte arrays.
|
static long |
bytesToXBigEndian(byte[] in,
int offset,
int size) |
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 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,
java.lang.Class clazz) |
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 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 |
longToBigEndian(long value,
byte[] in,
int 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 longToBigEndian(long value, byte[] in, int offset)
public static long bytesToXBigEndian(byte[] in, int offset, int size)
public static byte[] cloneArray(byte[] in)
in
- byte array.public static byte[][] cloneArray(byte[][] in)
in
- 2d byte array.public static boolean areEqual(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, java.lang.Class clazz) 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)