java.security
public
abstract
class
java.security.MessageDigest
Summary
Protected Constructors
Public Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Protected Constructors
protected
MessageDigest(String algorithm)
Public Methods
public
Object
clone()
Returns a new instance of the same class as the receiver, whose slots
have been filled in with the values in the slots of the receiver.
Classes which wish to support cloning must specify that they implement
the Cloneable interface, since the implementation checks for this.
public
byte[]
digest()
Computes and returns the final hash value that the receiver represents.
After the digest is computed the receiver is reset.
Returns
- the hash the receiver computed
public
byte[]
digest(byte[] input)
public
int
digest(byte[] buf, int offset, int len)
public
final
String
getAlgorithm()
Returns the standard Java Security name for the algorithm being used by
the receiver.
Returns
- String the name of the algorithm
public
final
int
getDigestLength()
Return the engine digest length in bytes. Default is 0.
Returns
- int the engine digest length in bytes
Returns a new MessageDigest which is capable of running the algorithm
described by the argument. The result will be an instance of a subclass
of MessageDigest which implements that algorithm.
Parameters
algorithm
| java.lang.String Name of the algorithm desired |
provider
| Provider Provider which has to implement the algorithm |
Returns
- MessageDigest a concrete implementation for the algorithm
desired.
public
final
Provider
getProvider()
Returns the Provider of the digest represented by the receiver.
Returns
- Provider an instance of a subclass of java.security.Provider
public
static
boolean
isEqual(byte[] digesta, byte[] digestb)
Does a simply byte-per-byte compare of the two digests.
Parameters
digesta
| One of the digests to compare |
digestb
| The digest to compare to |
Returns
true
if the two hashes are equal
false
if the two hashes are not equal
public
void
reset()
Puts the receiver back in an initial state, such that it is ready to
compute a new hash.
public
String
toString()
Returns a string containing a concise, human-readable description of the
receiver.
Returns
- a printable representation for the receiver.
public
void
update(byte[] input)
public
void
update(byte arg0)
Includes the argument in the hash value computed
by the receiver.
Parameters
arg0
| byte
the byte to feed to the hash algorithm |
public
void
update(byte[] input, int offset, int len)