|
Oracle Security Developer Tools Crypto Java API Reference 10g (10.1.4.0.1) B28171-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.security.crypto.core.MessageDigest
A generic class for computing message digests. Instantiate a subclass to implement a particular message digest algorithm (e.g., MD5).
To use, call one or more update()
methods in sequence, then call computeCurrent()
. The result of the digest computation can then be obtained using the getDigestBits()
method.
The init()
method may be called to reset the digest to its initial state. The digestValid
field indicates whether the value of digestBits
is valid, that is, no calls to update()
or init()
have been made since the last call to computeCurrent()
.
Nested Class Summary | |
class |
MessageDigest.MDState Class representing the current state of a message digest object. |
Field Summary | |
protected AlgorithmIdentifier |
algID |
byte[] |
digestBits The result of the hash computation. |
boolean |
digestValid Indicates whether the value of digestBits is valid. |
Constructor Summary | |
protected |
MessageDigest() Creates a new message digest object. |
Method Summary | |
abstract java.lang.String |
algName() Returns the algorithm name of this message digest. |
abstract int |
blockSize() |
abstract java.lang.Object |
clone() Returns a clone of this message digest object. |
abstract void |
computeCurrent() Completes the hash computation, performing any necessary operations such as padding. |
byte[] |
computeDigest(byte[] source) Performs a complete digest operation on the given array of bytes. |
byte[] |
computeDigest(Streamable o) |
abstract AlgorithmIdentifier |
getAlgID() |
byte[] |
getDigestBits() Returns a copy of the current digest bytes. |
abstract int |
getDigestLength() Returns the length in bytes of the message digest. |
static MessageDigest |
getInstance(AlgorithmIdentifier algID) |
protected abstract MessageDigest.MDState |
getState() |
abstract void |
init() Resets this message digest object to its initial state. |
boolean |
isEqual(byte[] otherDigest) Compares this digest to the specified digest for equality. |
static boolean |
isEqual(byte[] digesta, byte[] digestb) Deprecated. Use Utils.areEqual(byte[], byte[]) instead. |
void |
setAlgID(AlgorithmIdentifier algID) |
protected abstract void |
setState(MessageDigest.MDState state) |
java.lang.String |
toString() Returns a string representation of this message digest object. |
void |
update(boolean aValue) Adds one byte to the data being digested, either 1 (if the given boolean value is true), or 0 (if the given boolean value is false). |
abstract void |
update(byte aValue) Adds the specifed byte to the data being digested. |
void |
update(byte[] input) Adds the specified array of bytes to the data being digested. |
void |
update(byte[] input, int off, int len) Adds the specified sequence of bytes to the data being digested. |
void |
update(java.io.InputStream in) Adds characters from the specified input stream to the data being digested, until end of stream is reached. |
void |
update(int aValue) Adds four bytes -- the big-endian representation of the specified int value -- to the data being digested. |
void |
update(int[] input) Adds the specified array of int values to the data being digested, using big-endian representation. |
void |
update(long aValue) Adds eight bytes -- the big-endian representation of the specified long value -- to the data being digested. |
void |
update(long[] input) Adds the specified array of long values to the data being digested, using big-endian representation. |
void |
update(short aValue) Adds two bytes -- the big-endian representation of the specified short value -- to the data being digested. |
void |
update(short[] input) Adds the specified array of short values to the data being digested, using big-endian representation. |
void |
update(java.lang.String input) Adds the characters of the specified string to the data being digested. |
void |
updateASCII(java.lang.String input) Adds the characters of the specified string to the data being digested. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public byte[] digestBits
public boolean digestValid
digestBits
is valid.protected AlgorithmIdentifier algID
Constructor Detail |
protected MessageDigest()
Method Detail |
public void setAlgID(AlgorithmIdentifier algID) throws AlgorithmIdentifierException
AlgorithmIdentifierException
public abstract AlgorithmIdentifier getAlgID()
public abstract int blockSize()
public static MessageDigest getInstance(AlgorithmIdentifier algID) throws AlgorithmIdentifierException
AlgorithmIdentifierException
public abstract void init()
public abstract void update(byte aValue)
public void update(boolean aValue)
public void update(short aValue)
public void update(int aValue)
public void update(long aValue)
public void update(byte[] input, int off, int len)
input
- the input arrayoff
- start position in the input arraylen
- the number of input array elements to add to the data being digestedpublic void update(byte[] input)
public void update(short[] input)
public void update(int[] input)
public void update(long[] input)
public void update(java.lang.String input)
Each character is treated as a 16-bit value, and is appended in big-endian order.
public void updateASCII(java.lang.String input)
Each character is treated as a ISO-Latin1 (8-bit) character.
public void update(java.io.InputStream in) throws java.io.IOException
java.io.IOException
public abstract void computeCurrent()
getDigestBits()
.public byte[] getDigestBits()
public byte[] computeDigest(byte[] source)
That is, first init()
is called, then the byte array is given to update
, then computeCurrent()
is called.
public byte[] computeDigest(Streamable o) throws java.io.IOException
java.io.IOException
public static boolean isEqual(byte[] digesta, byte[] digestb)
Utils.areEqual(byte[], byte[])
instead.digesta
- the first digest bytesdigestb
- the second digest bytespublic boolean isEqual(byte[] otherDigest)
public abstract java.lang.String algName()
public abstract int getDigestLength()
public java.lang.String toString()
public abstract java.lang.Object clone()
protected abstract MessageDigest.MDState getState()
protected abstract void setState(MessageDigest.MDState state)
|
Oracle Security Developer Tools Crypto Java API Reference 10g (10.1.4.0.1) B28171-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |