public final class Bytes extends Object
| Modifier and Type | Method and Description |
|---|---|
static int |
byteArrayToInt(byte[] bytes)
Transforms a passed LSB first byte array to an int
|
static int |
byteArrayToInt(byte[] bytes,
int length)
Transforms a passed LSB first byte array to an int
|
static int |
byteArrayToInt(byte[] bytes,
int offset,
int length)
Transforms a passed LSB first byte array to an int
|
static byte[] |
concat(byte[]... chunks)
Returns the concatenation of the input arrays in a single array.
|
static boolean |
equal(byte[] x,
byte[] y)
Best effort fix-timing array comparison.
|
static byte[] |
intToByteArray(int capacity,
int value)
Transforms a passed value to a LSB first byte array with the size of the specified capacity
|
static byte[] |
xor(byte[] x,
byte[] y)
Computes the xor of two byte arrays of equal size.
|
static byte[] |
xor(byte[] x,
int offsetX,
byte[] y,
int offsetY,
int len)
Computes the xor of two byte arrays, specifying offsets and the length to xor.
|
static void |
xor(ByteBuffer output,
ByteBuffer x,
ByteBuffer y,
int len)
Computes the xor of two byte buffers, specifying the length to xor, and
stores the result to
output. |
static byte[] |
xorEnd(byte[] a,
byte[] b)
xors b to the end of a.
|
public static final boolean equal(byte[] x,
byte[] y)
public static byte[] concat(byte[]... chunks)
throws GeneralSecurityException
concat(new
byte[] {a, b}, new byte[] {}, new byte[] {c} returns the array {a, b, c}.GeneralSecurityExceptionpublic static final byte[] xor(byte[] x,
int offsetX,
byte[] y,
int offsetY,
int len)
public static final void xor(ByteBuffer output, ByteBuffer x, ByteBuffer y, int len)
output.public static final byte[] xor(byte[] x,
byte[] y)
public static final byte[] xorEnd(byte[] a,
byte[] b)
public static byte[] intToByteArray(int capacity,
int value)
capacity - size of the resulting byte arrayvalue - that should be represented as a byte arraypublic static int byteArrayToInt(byte[] bytes)
bytes - that should be transformed to a byte arraypublic static int byteArrayToInt(byte[] bytes,
int length)
bytes - that should be transformed to a byte arraylength - amount of the passed bytes that should be transformedpublic static int byteArrayToInt(byte[] bytes,
int offset,
int length)
bytes - that should be transformed to a byte arrayoffset - start index to start the transformationlength - amount of the passed bytes that should be transformed