com.motorola.iden.security
Class MessageDigestSpi

java.lang.Object
  |
  +--com.motorola.iden.security.MessageDigestSpi
Direct Known Subclasses:
MessageDigest

public abstract class MessageDigestSpi
extends java.lang.Object

This class defines the Service Provider Interface (SPI) for the MessageDigest class, which 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.

MOTOROLA and the Stylized M Logo are registered trademarks of Motorola, Inc. Reg. U.S. Pat. & Tm. Off.
© Copyright 2002 - 2004 Motorola, Inc. All Rights Reserved.

See Also:
[MessageDigest]

Constructor Summary
MessageDigestSpi()
           
 
Method Summary
protected abstract  byte[] engineDigest()
          Completes the hash computation by performing final operations such as padding.
protected  int engineGetDigestLength()
          Returns the digest length in bytes.
protected abstract  void engineReset()
          Resets the digest for further use.
protected abstract  void engineUpdate(byte input)
          Updates the digest using the specified byte.
protected abstract  void engineUpdate(byte[] input, int offset, int len)
          Updates the digest using the specified array of bytes, starting at the specified offset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageDigestSpi

public MessageDigestSpi()
Method Detail

engineGetDigestLength

protected int engineGetDigestLength()
Returns the digest length in bytes.

The default behavior is to return 0.

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

Returns:
the digest length in bytes.

engineUpdate

protected abstract void engineUpdate(byte input)
Updates the digest using the specified byte.
Parameters:
input - the byte to use for the update.

engineUpdate

protected abstract void engineUpdate(byte[] input,
                                     int offset,
                                     int len)
Updates the digest using the specified array of bytes, starting at the specified offset.
Parameters:
input - the array of bytes to use for the update.
offset - the offset to start from in the array of bytes.
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 engineDigest has been called, the engine should be reset. Resetting is the responsibility of the engine implementor.
Returns:
the array of bytes for the resulting hash value.

engineReset

protected abstract void engineReset()
Resets the digest for further use.