Next: , Previous: Message Digests, Up: Message Digests


6.1 IMessageDigest Interface

diagrams/hash_class_diag.png

Figure 8: Message Digest class diagram

— Function: void update (byte b)

Updates the hash being computed with a single byte.

— Function: void update (byte[] buf, int offset, int length)

Update the hash being computed with length of the bytes in buf starting at offset. The programmer should ensure that buf is at least offset + length bytes long.

— Function: byte [] digest ( )

Finishes the computation of the hash and returns the result as a byte array. The input read thusfar may be padded first (depending on the algorithm), and the instance is reset.

— Function: java.lang.String name ( )

Returns the canonical name of this message digest.

— Function: int hashSize ( )

Returns the size of the final hash (the byte array returned by digest()) in bytes.

— Function: int blockSize ( )

Returns the algorithm's internal block size, in bytes.

— Function: void reset ( )

Resets the internal state of the hash, making its state equivalent to that of a newly-created instance.

— Function: boolean selfTest ( )

Performs a simple conformance test of the underlying implementation, to guard against implementation or environment errors. Returns true if the test succeeds, false if it fails.

— Function: java.lang.Object clone ( )

Copies the state of this instance into a new instance, returning the copy. This copy can then be used in the same way as the original instance.