public final class KECCAK512
extends java.security.MessageDigest
The KECCAK-512 message digest algorithm produces a 512-bit hash-value
of the given input data. Notice that KECCAK-512 slightly differs from
the final NIST approved SHA3-512
message digest algorithm
and therefore is not output compatible to SHA3-512!
This class extends the java.security.MessageDigest
class and
applications should use one of the getInstance
methods presented
there to create a MessageDigest-KECCAK object. Generally, an application
wishing to compute the message digest of some data has to perform three
steps:
getInstance
method, e.g.:
MessageDigest KECCAK = MessageDigest.getInstance("KECCAK512");
update
methods,
e.g: KECCAK.update(m1); KECCAK.update(m2); ...
digest
methods: byte[] hash_value = KECCAK.digest();
There are several ways for combining update
and
digest
methods for computing a message digest. Since this class
implements the Cloneable
interface, KECCAK MessageDigest objects
may be used for compute intermediate hashes through cloning (see
http
://java.sun.com/products/JDK/1.2/docs/guide/security/CryptoSpec.html).
When the hash value successfully has been computed, the KECCAK MessageDigest object automatically resets for being able to be supplied with new data to be hashed..
MessageDigest
Constructor and Description |
---|
KECCAK512()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone() |
protected void |
doPadding() |
protected void |
engineCompress(byte[] input,
int offset) |
protected byte[] |
engineDigest() |
protected void |
engineDigest(byte[] output,
int offset) |
protected int |
engineDigest(byte[] buf,
int offset,
int len)
Calculates the digest value and writes it to the given
output buffer.
|
protected int |
engineGetDigestLength() |
protected void |
engineReset() |
protected void |
engineUpdate(byte input) |
protected void |
engineUpdate(byte[] input,
int offset,
int len) |
protected int engineGetDigestLength()
engineGetDigestLength
in class java.security.MessageDigestSpi
protected void engineCompress(byte[] input, int offset)
protected void doPadding()
protected void engineDigest(byte[] output, int offset)
protected byte[] engineDigest()
engineDigest
in class java.security.MessageDigestSpi
protected int engineDigest(byte[] buf, int offset, int len) throws java.security.DigestException
engineDigest
in class java.security.MessageDigestSpi
buf
- the output buffer in which to write the digestoffset
- the start offset in the output bufferlen
- the length of the digest value.java.security.DigestException
- if an error occurs when calculating the digest value.protected void engineUpdate(byte input)
engineUpdate
in class java.security.MessageDigestSpi
protected void engineUpdate(byte[] input, int offset, int len)
engineUpdate
in class java.security.MessageDigestSpi
protected void engineReset()
engineReset
in class java.security.MessageDigestSpi
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.security.MessageDigest
java.lang.CloneNotSupportedException