Class SHA1_MessageDigestImpl
java.lang.Object
java.security.MessageDigestSpi
org.apache.harmony.security.provider.crypto.SHA1_MessageDigestImpl
- All Implemented Interfaces:
Cloneable
public class SHA1_MessageDigestImpl extends MessageDigestSpi implements Cloneable
This class extends the MessageDigestSpi class implementing all its abstract methods;
it overrides the "Object clone()" and "int engineGetDigestLength()" methods.
The class implements the Cloneable interface.
The class implements the Cloneable interface.
-
Constructor Summary
Constructors Constructor Description SHA1_MessageDigestImpl()The constructor creates needed buffers and sets the engine at initial state -
Method Summary
Modifier and Type Method Description Objectclone()Returns a "deep" copy of this SHA1MDImpl object.protected byte[]engineDigest()Computes a message digest value.protected intengineDigest(byte[] buf, int offset, int len)Computes message digest value.protected intengineGetDigestLength()Returns a message digest length.protected voidengineReset()Resets the engine.protected voidengineUpdate(byte input)Supplements a byte to current message.protected voidengineUpdate(byte[] input, int offset, int len)Updates current message.Methods inherited from class java.security.MessageDigestSpi
engineUpdate
-
Constructor Details
-
SHA1_MessageDigestImpl
public SHA1_MessageDigestImpl()The constructor creates needed buffers and sets the engine at initial state
-
-
Method Details
-
clone
Returns a "deep" copy of this SHA1MDImpl object.
The method overrides "clone()" in class Object.- Overrides:
clonein classMessageDigestSpi- Returns:
- a clone of this object
- Throws:
CloneNotSupportedException- if this object's class does not implement theCloneableinterface.
-
engineDigest
protected byte[] engineDigest()Computes a message digest value.
The method resets the engine.
The method overrides "engineDigest()" in class MessageDigestSpi.- Specified by:
engineDigestin classMessageDigestSpi- Returns:
- byte array containing message digest value
- See Also:
MessageDigestSpi.engineReset()
-
engineDigest
Computes message digest value. Upon return, the value is stored in "buf" buffer beginning "offset" byte.
The method resets the engine.
The method overrides "engineDigest(byte[],int,int) in class MessageDigestSpi.- Overrides:
engineDigestin classMessageDigestSpi- Parameters:
buf- byte array to store a message digest returnedoffset- a position in the array for first byte of the message digestlen- number of bytes within buffer allotted for the message digest; as this implementation doesn't provide partial digests, len should be >= 20, DigestException is thrown otherwise- Returns:
- the length of the message digest stored in the "buf" buffer; in this implementation the length=20
- Throws:
IllegalArgumentException- if null is passed to the "buf" argument
if offset + len > buf.length
if offset > buf.length or len > buf.lengthDigestException- if len < 20ArrayIndexOutOfBoundsException- if offset < 0- See Also:
MessageDigestSpi.engineReset()
-
engineGetDigestLength
protected int engineGetDigestLength()Returns a message digest length.
The method overrides "engineGetDigestLength()" in class MessageDigestSpi.- Overrides:
engineGetDigestLengthin classMessageDigestSpi- Returns:
- total length of current message digest as an int value
-
engineReset
protected void engineReset()Resets the engine.
The method overrides "engineReset()" in class MessageDigestSpi.- Specified by:
engineResetin classMessageDigestSpi
-
engineUpdate
protected void engineUpdate(byte input)Supplements a byte to current message.
The method overrides "engineUpdate(byte)" in class MessageDigestSpi.- Specified by:
engineUpdatein classMessageDigestSpi- Parameters:
input- byte to add to current message- See Also:
MessageDigestSpi.engineReset()
-
engineUpdate
protected void engineUpdate(byte[] input, int offset, int len)Updates current message.
The method overrides "engineUpdate(byte[],int,int)" in class MessageDigestSpi.
The method silently returns if "len" <= 0.- Specified by:
engineUpdatein classMessageDigestSpi- Parameters:
input- a byte arrayoffset- a number of first byte in the "input" array to use for updatinglen- a number of bytes to use- Throws:
NullPointerException- if null is passed to the "buf" argumentIllegalArgumentException- if offset > buf.length or len > buf.length or (len + offset) > buf.lengthArrayIndexOutOfBoundsException- offset < 0
-