- java.lang.Object
-
- java.security.MessageDigestSpi
-
- com.ibm.crypto.hdwrCCA.provider.SHA
-
- All Implemented Interfaces:
java.lang.Cloneable
public final class SHA extends java.security.MessageDigestSpi
This class implements the Secure Hash Algorithm (SHA) developed by the National Institute of Standards and Technology along with the National Security Agency. This is the updated version of SHA fip-180 as superseded by fip-180-1.
-
-
Constructor Summary
Constructors Constructor Description SHA()
Standard constructor, creates a new SHA instance, allocates its buffers from the heap.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
Clones this object.protected byte[]
engineDigest()
Computes and returns the SHA hash.protected int
engineDigest(byte[] buf, int offset, int len)
Computes and returns the SHA hash in the buffer provided.protected int
engineGetDigestLength()
Return the digest length in bytes.protected void
engineReset()
Resets the SHA information back to starting values.protected void
engineUpdate(byte b)
Update adds the passed byte to the digested data.protected void
engineUpdate(byte[] input, int offset, int len)
Update adds the selected part of an array of bytes to the digest.void
init()
Initializes the SHA information.
-
-
-
Method Detail
-
init
public void init()
Initializes the SHA information.
-
engineReset
protected void engineReset()
Resets the SHA information back to starting values.- Specified by:
engineReset
in classjava.security.MessageDigestSpi
-
engineGetDigestLength
protected int engineGetDigestLength()
Return the digest length in bytes.- Overrides:
engineGetDigestLength
in classjava.security.MessageDigestSpi
-
engineUpdate
protected void engineUpdate(byte b)
Update adds the passed byte to the digested data.- Specified by:
engineUpdate
in classjava.security.MessageDigestSpi
- Parameters:
b
- is the byte to update the digest with.
-
engineUpdate
protected void engineUpdate(byte[] input, int offset, int len)
Update adds the selected part of an array of bytes to the digest. This version is more efficient than the byte-at-a-time version; it avoids data copies and reduces per-byte call overhead.- Specified by:
engineUpdate
in classjava.security.MessageDigestSpi
- Parameters:
input
- array to be used to update digest.offset
- the offset into the array.len
- the length of the array.
-
engineDigest
protected byte[] engineDigest()
Computes and returns the SHA hash.- Specified by:
engineDigest
in classjava.security.MessageDigestSpi
- Returns:
- the SHA hash.
-
engineDigest
protected int engineDigest(byte[] buf, int offset, int len) throws java.security.DigestException
Computes and returns the SHA hash in the buffer provided.- Overrides:
engineDigest
in classjava.security.MessageDigestSpi
- Parameters:
buf
- the buffer to put the MD5 hash into.offset
- is the offset in the buffer into which to copy the hash.len
- the length of the buffer.- Throws:
java.security.DigestException
- is thrown when buf is not large enough to hold the resulting digest.
-
clone
public java.lang.Object clone()
Clones this object.- Overrides:
clone
in classjava.security.MessageDigestSpi
-
-