|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--cryptix.security.MessageHash
This class represents the output from a message digest, in a form where the type can be ascertained.
Copyright © 1995-1997
Systemics Ltd
on behalf of the
Cryptix Development Team.
All rights reserved.
$Revision: 1.3 $
Constructor Summary | |
MessageHash(java.lang.String algorithm,
byte[] hash)
Constructs a MessageHash for the specified algorithm name. |
Method Summary | |
boolean |
equals(java.lang.Object obj)
Tests whether this object is equal to another object. |
static MessageHash |
fromDigest(MessageDigest md)
Creates a MessageHash with the value found by calling the digest()
method on md. |
static MessageHash |
fromDigest(MessageDigest md,
byte[] data)
Creates a MessageHash with the value found by calling the digest(byte[])
method on md. |
java.lang.String |
getAlgorithm()
Returns the name of the algorithm associated with this hash. |
int |
hashCode()
|
int |
length()
Returns the hash length in bytes. |
byte[] |
toByteArray()
Returns the hash as a new byte array. |
java.lang.String |
toString()
Returns a big endian Hex string showing the value of the hash, prefixed by the standard algorithm name and a colon. |
Methods inherited from class java.lang.Object |
|
Constructor Detail |
public MessageHash(java.lang.String algorithm, byte[] hash)
algorithm
- the name of the MessageDigest algorithm.hash
- a byte array containing the hash.NullPointerException
- if algorithm == null || hash == nullMethod Detail |
public static MessageHash fromDigest(MessageDigest md)
digest()
method on md. This causes md to be reset. It is equivalent to:
new MessageHash(md.name(), md.digest())
public static MessageHash fromDigest(MessageDigest md, byte[] data)
digest(byte[])
method on md. This causes md to be reset. It is equivalent to:
new MessageHash(md.name(), md.digest(data))
public java.lang.String getAlgorithm()
public final byte[] toByteArray()
public final int length()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
Two MessageHash objects are equal iff they are for the same algorithm, and have the same value as a sequence of bytes.
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |