|
TUM CCSM Commons | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.tum.cs.commons.digest.MD5Digest
public final class MD5Digest
An MD5 digest. This is just a thin thin wrapper around a byte array with some
convenience methods and hashCode()
, equals(Object)
and
compareTo(MD5Digest)
implemented correctly. This class is used
instead of plain strings to save both memory and (some) execution time. The
class is immutable. Custom (de)serialization is provided to make this
efficient to use in storage or RMI senarios.
Nested Class Summary | |
---|---|
static class |
MD5Digest.Comparator
Comparator for MD5Digest . |
Field Summary | |
---|---|
static int |
MD5_BYTES
Number of bytes in an MD5 sum. |
Constructor Summary | |
---|---|
MD5Digest(byte[] digest)
Constructor. |
|
MD5Digest(java.security.MessageDigest digester)
Constructor. |
Method Summary | |
---|---|
int |
compareTo(MD5Digest o)
|
boolean |
equals(java.lang.Object o)
|
byte[] |
getBytes()
Returns a copy of the internal byte representation. |
int |
hashCode()
|
void |
insertIntoDigester(java.security.MessageDigest md)
Inserts the digest data into the given MD. |
int |
partialHashCode()
Calculates and returns a hashcode that only depends on the first 3 bytes. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MD5_BYTES
Constructor Detail |
---|
public MD5Digest(java.security.MessageDigest digester)
MessageDigest.digest()
, so the digester
will be reset afterwards.
public MD5Digest(byte[] digest)
Method Detail |
---|
public void insertIntoDigester(java.security.MessageDigest md)
This method is provided instead of a getter, to keep this immutable.
public int hashCode()
hashCode
in class java.lang.Object
public int partialHashCode()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int compareTo(MD5Digest o)
compareTo
in interface java.lang.Comparable<MD5Digest>
public byte[] getBytes()
public java.lang.String toString()
toString
in class java.lang.Object
|
TUM CCSM Commons | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |