Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.novell.java.security
Class MessageDigestSpi

    java.lang.Object
      |
      +--com.novell.java.security.MessageDigestSpi

public abstract class MessageDigestSpi
extends java.lang.Object

Defines the Service Provider Interface (SPI) for the MessageDigest class. The MessageDigest class provides the functionality of a message digest algorithm, such as MD5 or SHA. Message digests are secure one-way hash functions that take arbitrary-sized data and output a fixed-length hash value.

All the abstract methods in this class must be implemented by a cryptographic service provider who wishes to supply the implementation of a particular message digest algorithm. Implementations are free to implement the Cloneable interface.

See Also:
  `MessageDigest`

Constructor Summary
`MessageDigestSpi()`

Method Summary
`java.lang.Object` | `clone()` Creates a new message digest object of the same class as this message digest object.
`protected abstract byte[]` | `engineDigest()` Completes the hash computation by performing final operations such as padding.
`protected int` | `engineDigest(byte[] buf, int offset, int len)` Completes the hash computation by performing final operation such as padding.
`protected int` | `engineGetDigestLength()` Returns the message digest length in bytes.
`protected abstract void` | `engineReset()` Resets the digest for further use.
`protected abstract void` | `engineUpdate(byte input)` Updates the message digest using the specified byte.
`protected abstract void` | `engineUpdate(byte[] input, int offset, int len)` Updates the message digest using the specified array of bytes, starting at the specified offset.

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### MessageDigestSpi

    public MessageDigestSpi()

Method Detail

### engineGetDigestLength

    protected int engineGetDigestLength()

  Returns the message digest length in bytes. This concrete method has been added to this previously-defined abstract class for backwards compatibility (it cannot be abstract).
  Returns:
    The digest length in bytes, but the method may be overridden by a provider to return the digest length. The default behavior is to return 0.
  Since:
    JDK1.2

### engineUpdate

    protected abstract void engineUpdate(byte input)

  Updates the message digest using the specified byte.
  Parameters:
    `input` - The byte to use for updating the message digest.

### engineUpdate

    protected abstract void engineUpdate(byte[] input,
                                         int offset,
                                         int len)

  Updates the message digest using the specified array of bytes, starting at the specified offset. This should be a no-op if the digest has been finalized.
  Parameters:
    `input` - The array of bytes to use for updating the message digest.
    `offset` - The offset in the array of bytes from which to start.
    `len` - The number of bytes to use, starting at offset.

### engineDigest

    protected abstract byte[] engineDigest()

  Completes the hash computation by performing final operations such as padding. Once the engineDigest() method has been called, the engine should be reset with the engineReset() method. Resetting is the responsibility of the engine implementor.
  Returns:
    The array of bytes for the resulting hash value.

### engineDigest

    protected int engineDigest(byte[] buf,
                               int offset,
                               int len)
                        throws DigestException

  Completes the hash computation by performing final operation such as padding. Once the engineDigest() method has been called, the engine should be reset with the engineReset() method. Resetting is the responsibility of the engine implementor.

  This method should be abstract, but we leave it concrete for binary compatibility. Knowledgeable providers should override this method. Both this default implementation and the SUN provider do not return partial digests. The presence of the len parameter is solely for consistency in our APIs. If the value of the len parameter is less than the actual digest length, the method will throw a DigestException. The len parameter is ignored if its value is greater than or equal to the actual digest length.

  Parameters:
    `buf` - The output buffer in which to store the message digest.
    `offset` - The offset in the output buffer from which to start.
    `len` - The number of bytes within the output buffer (buf) allotted for the digest.
  Returns:
    The length of the message digest stored in the output buffer.
  Throws:
    DigestException - Thrown if an error occurs.
  Since:
    JDK1.2

### engineReset

    protected abstract void engineReset()

  Resets the digest for further use.

### clone

    public java.lang.Object clone()
                           throws java.lang.CloneNotSupportedException

  Creates a new message digest object of the same class as this message digest object. It then initializes each of the new object's fields by assigning it the same value as the corresponding field in this object. The clone() method will only clone a message digest object if the implementation is Cloneable. A class indicates that its instances can be cloned by declaring that it implements the Cloneable interface.
  Returns:
    a clone if the implementation is cloneable.
  Throws:
    java.lang.CloneNotSupportedException - Thrown if the clone() method is called on an implementation that does not support Cloneable.
  Overrides:
    clone in class java.lang.Object

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD