public final class SHA extends MessageDigest
MessageDigest.MDStatealgID| Constructor and Description |
|---|
SHA()
Empty constructor.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
algName()
Returns the algorithm name of this message digest.
|
int |
blockSize()
Returns the block size the message digest.
|
java.lang.Object |
clone()
Clone this object.
|
void |
computeCurrent()
Completes the hash computation, performing any necessary operations such as padding.
|
AlgorithmIdentifier |
getAlgID()
Returns the algorithm identifier of this message digest.
|
byte[] |
getDigestBits()
Returns a copy of the current digest bytes.
|
int |
getDigestLength()
Returns the length in bytes of the message digest.
|
protected MessageDigest.MDState |
getState()
Gets the state of this MessageDigest instance.
|
void |
init()
Resets this message digest object to its initial state.
|
boolean |
isValid()
Returns
true if this SHA is in a valid state and its digest bits are usable; otherwise returns false. |
void |
setAlgID(AlgorithmIdentifier algID)
Sets the SHA algorithm to use.
|
protected void |
setState(MessageDigest.MDState state)
Sets the state of this MessageDigest instance.
|
void |
update(byte aValue)
Adds one byte to the data being digested.
|
void |
update(byte[] input, int off, int len)
Adds the specified sequence of bytes to the data being digested.
|
computeDigest, computeDigest, getInstance, isEqual, toString, update, update, update, update, update, update, update, update, update, update, update, updateASCIIpublic SHA()
SHA object will implement the SHA-1 algorithm. To use another SHA algorithm, use the setAlgID method.public void setAlgID(AlgorithmIdentifier algID) throws AlgorithmIdentifierException
setAlgID in class MessageDigestalgID - The AlgorithmIdentifier to use.AlgorithmIdentifierExceptionAlgIDpublic AlgorithmIdentifier getAlgID()
getAlgID in class MessageDigestpublic java.lang.String algName()
algName in class MessageDigestpublic int blockSize()
blockSize in class MessageDigestpublic int getDigestLength()
getDigestLength in class MessageDigestpublic void init()
init in class MessageDigest
public void update(byte[] input,
int off,
int len)
update in class MessageDigestinput - 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 aValue)
update in class MessageDigestpublic byte[] getDigestBits()
getDigestBits in class MessageDigestpublic boolean isValid()
true if this SHA is in a valid state and its digest bits are usable; otherwise returns false.isValid in class MessageDigestpublic void computeCurrent()
digestBits.computeCurrent in class MessageDigestpublic java.lang.Object clone()
clone in class MessageDigestprotected MessageDigest.MDState getState()
MessageDigestgetState in class MessageDigestprotected void setState(MessageDigest.MDState state)
MessageDigestsetState in class MessageDigest