public interface Digest
| 限定符和类型 | 方法和说明 |
|---|---|
Digest |
copy()
Clone the current state.
|
byte[] |
digest()
Finalize the current hash computation and return the hash value
in a newly-allocated array.
|
byte[] |
digest(byte[] inbuf)
Input some bytes, then finalize the current hash computation
and return the hash value in a newly-allocated array.
|
int |
digest(byte[] outbuf,
int off,
int len)
Finalize the current hash computation and store the hash value
in the provided output buffer.
|
int |
getBlockLength()
Return the "block length" for the hash function.
|
int |
getDigestLength()
Get the natural hash function output length (in bytes).
|
void |
reset()
Reset the object: this makes it suitable for a new hash
computation.
|
java.lang.String |
toString()
Get the display name for this function (e.g.
|
void |
update(byte in)
Insert one more input data byte.
|
void |
update(byte[] inbuf)
Insert some more bytes.
|
void |
update(byte[] inbuf,
int off,
int len)
Insert some more bytes.
|
void update(byte in)
in - the input bytevoid update(byte[] inbuf)
inbuf - the data bytesvoid update(byte[] inbuf,
int off,
int len)
inbuf - the data bufferoff - the data offset in inbuflen - the data length (in bytes)byte[] digest()
byte[] digest(byte[] inbuf)
inbuf - the input dataint digest(byte[] outbuf,
int off,
int len)
len parameter
contains the maximum number of bytes that should be written;
no more bytes than the natural hash function output length will
be produced. If len is smaller than the natural
hash output length, the hash output is truncated to its first
len bytes. The object is resetted.outbuf - the output bufferoff - the output offset within outbuflen - the requested hash output length (in bytes)outbufint getDigestLength()
void reset()
Digest copy()
int getBlockLength()
Return the "block length" for the hash function. This
value is naturally defined for iterated hash functions
(Merkle-Damgard). It is used in HMAC (that's what the
HMAC specification
names the "B" parameter).
If the function is "block-less" then this function may
return -n where n is an integer such that the
block length for HMAC ("B") will be inferred from the
key length, by selecting the smallest multiple of n
which is no smaller than the key length. For instance, for
the Fugue-xxx hash functions, this function returns -4: the
virtual block length B is the HMAC key length, rounded up to
the next multiple of 4.
-njava.lang.String toString()
Get the display name for this function (e.g. "SHA-1"
for SHA-1).
toString 在类中 java.lang.ObjectObjectCopyright © 2018. All Rights Reserved.