public class ByteArrayImpl extends java.lang.Object implements PrfKey, PrfPreimage, PrfImage
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
data |
| Constructor and Description |
|---|
ByteArrayImpl(byte[] bytes) |
ByteArrayImpl(Representation repr) |
| Modifier and Type | Method and Description |
|---|---|
ByteArrayImpl |
append(ByteArrayImpl a)
Create new byte array as concatenation of
this with a. |
boolean |
equals(java.lang.Object obj) |
static ByteArrayImpl |
fromRandom(int numberBytes)
Creates a new
ByteArrayImpl instance filled with numberBytes bytes of randomness |
byte[] |
getData() |
Representation |
getRepresentation()
The representation of this object.
|
int |
hashCode() |
int |
length()
Returns the length of this byte array.
|
ByteArrayImpl |
substring(int firstIndex,
int length)
Returns an array containing the designated part of this byte array, meaning that
returned[i] = this[firstIndex+i]. |
java.lang.String |
toString() |
ByteAccumulator |
updateAccumulator(ByteAccumulator accumulator)
Updates the ByteAccumulator with the unique byte representation of this object.
|
ByteArrayImpl |
xor(ByteArrayImpl a)
Compute exclusive or of two byte arrays.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetUniqueByteRepresentationpublic ByteArrayImpl(byte[] bytes)
public ByteArrayImpl(Representation repr)
public static ByteArrayImpl fromRandom(int numberBytes)
ByteArrayImpl instance filled with numberBytes bytes of randomnessnumberBytes - number of random bytes / length of resulting ByteArrayImplementationpublic byte[] getData()
public ByteArrayImpl append(ByteArrayImpl a)
this with a.a - the array to appendpublic ByteArrayImpl substring(int firstIndex, int length)
returned[i] = this[firstIndex+i].firstIndex - first (byte) index that will be copied to the resultlength - the number of bytes to be copiedlength that is a substring of this original.public int length()
public ByteArrayImpl xor(ByteArrayImpl a)
Returns a new byte array where the i-th entry is the exclusive or of this
byte array's i-th entry and a's i-th entry.
a - the argument to XOR this withpublic Representation getRepresentation()
RepresentableReprUtilgetRepresentation in interface RepresentableRepresentationpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic ByteAccumulator updateAccumulator(ByteAccumulator accumulator)
UniqueByteRepresentableThe input to the accumulators update function is an injective (with respect to a given domain) byte encoding of this object.
For many use-cases, the AnnotatedUbrUtil can be used to quickly implement this method.
updateAccumulator in interface UniqueByteRepresentable