sun.security.provider
Class SHA5

java.lang.Object
  extended by java.security.MessageDigestSpi
      extended by sun.security.provider.SHA5
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
SHA3

public class SHA5
extends MessageDigestSpi
implements Cloneable

This class implements the Secure Hash Algorithm SHA-512 developed by the National Institute of Standards and Technology along with the National Security Agency.

It implements java.security.MessageDigestSpi, and can be used through Java Cryptography Architecture (JCA), as a pluggable MessageDigest implementation.


Constructor Summary
SHA5()
          Creates a new SHA object.
 
Method Summary
 Object clone()
          Returns a clone if the implementation is cloneable.
protected  byte[] engineDigest()
          Computes the final hash and returns the final value as a byte array.
protected  int engineDigest(byte[] hashvalue, int offset, int len)
          Computes the final hash and places the final value in the specified array.
protected  int engineGetDigestLength()
          Returns the digest length in bytes.
protected  void engineReset()
          Resets the buffers and hash value to start a new hash.
protected  void engineUpdate(byte b)
          Update a byte.
protected  void engineUpdate(byte[] b, int off, int len)
          Update a buffer.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SHA5

public SHA5()
Creates a new SHA object.

Method Detail

engineGetDigestLength

protected int engineGetDigestLength()
Description copied from class: MessageDigestSpi
Returns the digest length in bytes.

This concrete method has been added to this previously-defined abstract class. (For backwards compatibility, it cannot be abstract.)

The default behavior is to return 0.

This method may be overridden by a provider to return the digest length.

Overrides:
engineGetDigestLength in class MessageDigestSpi
Returns:
the length of the digest in bytes

engineUpdate

protected void engineUpdate(byte b)
Update a byte.

Specified by:
engineUpdate in class MessageDigestSpi
Parameters:
b - the byte

engineUpdate

protected void engineUpdate(byte[] b,
                            int off,
                            int len)
Update a buffer.

Specified by:
engineUpdate in class MessageDigestSpi
Parameters:
b - the data to be updated.
off - the start offset in the data
len - the number of bytes to be updated.

engineReset

protected void engineReset()
Resets the buffers and hash value to start a new hash.

Specified by:
engineReset in class MessageDigestSpi

engineDigest

protected byte[] engineDigest()
Computes the final hash and returns the final value as a byte array. The object is reset to be ready for further use, as specified in java.security.MessageDigest javadoc specification.

Specified by:
engineDigest in class MessageDigestSpi
Returns:
the array of bytes for the resulting hash value.

engineDigest

protected int engineDigest(byte[] hashvalue,
                           int offset,
                           int len)
                    throws DigestException
Computes the final hash and places the final value in the specified array. The object is reset to be ready for further use, as specified in java.security.MessageDigest javadoc specification.

Overrides:
engineDigest in class MessageDigestSpi
Parameters:
hashvalue - buffer to hold the digest
offset - offset for storing the digest
len - length of the buffer
Returns:
length of the digest in bytes
Throws:
DigestException - if an error occurs.

clone

public Object clone()
Description copied from class: MessageDigestSpi
Returns a clone if the implementation is cloneable.

Overrides:
clone in class MessageDigestSpi
Returns:
a clone if the implementation is cloneable.
See Also:
Cloneable