public final class Blake2b extends Object
| Constructor and Description |
|---|
Blake2b(byte[] key,
int digestLength)
Creates a new keyed
Blake2b instance. |
Blake2b(int digestLength)
Creates a new unkeyed
Blake2b instance. |
| Modifier and Type | Method and Description |
|---|---|
void |
burn()
Erases the key and resets the digest, making this instance
functionally equivalent to a newly created unkeyed digest.
|
Blake2b |
copy()
Returns a copy of this object.
|
byte[] |
digest()
Completes the hash computation.
|
byte[] |
digest(byte... input)
Performs a final update on the digest using the specified array of
bytes, then completes the digest computation.
|
byte[] |
digest(byte[] input,
int off,
int len)
Performs a final update on the digest using the specified data bytes,
then completes the digest computation.
|
int |
length()
Returns the digest's length (in bytes).
|
Blake2b |
reset()
Resets the digest.
|
Blake2b |
update(byte... input)
Updates the digest using the given array of bytes.
|
Blake2b |
update(byte input)
Updates the digest using the given byte.
|
Blake2b |
update(byte[] input,
int off,
int len)
Updates the digest using the specified number of bytes from the given
array, starting at the specified offset.
|
public Blake2b(int digestLength)
Blake2b instance.digestLength - the desired digest's length (in bytes).IllegalArgumentException - if digestLength is not in
the [1, 64] range.public Blake2b(byte[] key,
int digestLength)
Blake2b instance. If the key is empty,
then the created instance is equivalent to an unkeyed digest. The
given key can be safely erased from memory after this constructor has
been called.key - the key to use.digestLength - the desired digest's length (in bytes).NullPointerException - if key is null.IllegalArgumentException - if key's length is greater
than 64 or if digestLength is not in the
[1, 64] range.public void burn()
public Blake2b copy()
public int length()
public Blake2b reset()
public Blake2b update(byte input)
input - the byte with which to update the digest.public Blake2b update(byte... input)
input - the array of bytes with which to update the digest.NullPointerException - if input is null.public Blake2b update(byte[] input, int off, int len)
input - the array of bytes.off - the offset to start from in the array, inclusive.len - the number of bytes to use, starting at off.NullPointerException - if input is null.IndexOutOfBoundsException - if off is negative or if
len is negative or if off + len is greater than
input's length.public byte[] digest(byte... input)
update(byte...), passing the input array to the
update method, then calls digest(). Note that the digest is
reset after this call is made.input - the array of bytes with which to update the digest
before completing its computation.NullPointerException - if input is null.public byte[] digest(byte[] input,
int off,
int len)
update(byte[], int, int), passing the input array to
the update method, then calls digest(). Note that the digest
is reset after this call is made.input - the array of bytes.off - the offset to start from in the array, inclusive.len - the number of bytes to use, starting at off.NullPointerException - if input is null.IndexOutOfBoundsException - if off is negative or if
len is negative or if off + len is greater than
input's length.public byte[] digest()
Copyright © 2017. All rights reserved.