org.sf.rhash
Class Digest

java.lang.Object
  extended by org.sf.rhash.Digest

public final class Digest
extends Object

Message digest.


Method Summary
 String base32()
          Returns value of this digest as base32 string.
 String base64()
          Returns value of this digest as base64 string.
 boolean equals(Object obj)
          Tests whether this object equals to another one
protected  void finalize()
          Called by garbage collector to free native resources.
 int hashCode()
          Returns hash code for this object.
 HashType hashType()
          Returns type of hashing algorithm that produced this digest.
 String hex()
          Returns value of this digest as hexadecimal string.
 byte[] raw()
          Returns value of this digest as raw bytes.
 String toString()
          Returns string representation of this object.
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

hashType

public HashType hashType()
Returns type of hashing algorithm that produced this digest.

Returns:
type of hashing algorithm

raw

public byte[] raw()
Returns value of this digest as raw bytes. This method allocates new byte array, modifying it has no effect on this Digest.

Returns:
value of this digest as raw bytes
See Also:
hex(), base32(), base64()

hex

public String hex()
Returns value of this digest as hexadecimal string.

Returns:
value of the digest as hexadecimal string
See Also:
raw(), base32(), base64()

base32

public String base32()
Returns value of this digest as base32 string.

Returns:
value of the digest as base32 string
See Also:
raw(), hex(), base64()

base64

public String base64()
Returns value of this digest as base64 string.

Returns:
value of the digest as base64 string
See Also:
raw(), hex(), base32()

finalize

protected void finalize()
Called by garbage collector to free native resources.

Overrides:
finalize in class Object

toString

public String toString()
Returns string representation of this object. If default output for hashing algorithm is base32 then returned value is the same as if base32() method was called; otherwise value is the same as returned by hex() method.

Overrides:
toString in class Object
Returns:
string representation of this object
See Also:
base32(), hex()

equals

public boolean equals(Object obj)
Tests whether this object equals to another one

Overrides:
equals in class Object
Parameters:
obj - object to compare to
Returns:
true if obj is Digest instance with the same HashType and value; otherwise false

hashCode

public int hashCode()
Returns hash code for this object.

Overrides:
hashCode in class Object
Returns:
hash code for the object