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.
  • Constructor Details

    • SHA1_MessageDigestImpl

      public SHA1_MessageDigestImpl()
      The constructor creates needed buffers and sets the engine at initial state
  • Method Details

    • clone

      public Object clone() throws CloneNotSupportedException
      Returns a "deep" copy of this SHA1MDImpl object.
      The method overrides "clone()" in class Object.
      Overrides:
      clone in class MessageDigestSpi
      Returns:
      a clone of this object
      Throws:
      CloneNotSupportedException - if this object's class does not implement the Cloneable interface.
    • engineDigest

      protected byte[] engineDigest()
      Computes a message digest value.
      The method resets the engine.
      The method overrides "engineDigest()" in class MessageDigestSpi.
      Specified by:
      engineDigest in class MessageDigestSpi
      Returns:
      byte array containing message digest value
      See Also:
      MessageDigestSpi.engineReset()
    • engineDigest

      protected int engineDigest​(byte[] buf, int offset, int len) throws DigestException
      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:
      engineDigest in class MessageDigestSpi
      Parameters:
      buf - byte array to store a message digest returned
      offset - a position in the array for first byte of the message digest
      len - 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.length
      DigestException - if len < 20
      ArrayIndexOutOfBoundsException - if offset < 0
      See Also:
      MessageDigestSpi.engineReset()
    • engineGetDigestLength

      protected int engineGetDigestLength()
      Returns a message digest length.
      The method overrides "engineGetDigestLength()" in class MessageDigestSpi.
      Overrides:
      engineGetDigestLength in class MessageDigestSpi
      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:
      engineReset in class MessageDigestSpi
    • engineUpdate

      protected void engineUpdate​(byte input)
      Supplements a byte to current message.
      The method overrides "engineUpdate(byte)" in class MessageDigestSpi.
      Specified by:
      engineUpdate in class MessageDigestSpi
      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:
      engineUpdate in class MessageDigestSpi
      Parameters:
      input - a byte array
      offset - a number of first byte in the "input" array to use for updating
      len - a number of bytes to use
      Throws:
      NullPointerException - if null is passed to the "buf" argument
      IllegalArgumentException - if offset > buf.length or len > buf.length or (len + offset) > buf.length
      ArrayIndexOutOfBoundsException - offset < 0