Hash

A Cryptographic {@code Hash} represents a one-way conversion algorithm that transforms an input source to an underlying byte array. Hex and Base64-encoding output of the hashed bytes are automatically supported by the inherited {@link #toHex() toHex()} and {@link #toBase64() toBase64()} methods. <p/> The bytes returned by the parent interface's {@link #getBytes() getBytes()} are the hashed value of the original input source, also known as the 'checksum' or 'digest'.

@see Md2Hash @see Md5Hash @see Sha1Hash @see Sha256Hash @see Sha384Hash @see Sha512Hash

Members

Functions

getAlgorithmName
string getAlgorithmName()

Returns the name of the algorithm used to hash the input source, for example, {@code SHA-256}, {@code MD5}, etc. <p/> The name is expected to be a {@link java.security.MessageDigest MessageDigest} algorithm name.

getIterations
int getIterations()

Returns the number of hash iterations used to compute the hash.

getSalt
ByteSource getSalt()

Returns a salt used to compute the hash or {@code null} if no salt was used.

Inherited Members

From ByteSource

getBytes
byte[] getBytes()

Returns the wrapped byte array.

toHex
string toHex()

Returns the <a href="http://en.wikipedia.org/wiki/Hexadecimal">Hex</a>-formatted string representation of the underlying wrapped byte array.

toBase64
string toBase64()

Returns the <a href="http://en.wikipedia.org/wiki/Base64">Base 64</a>-formatted string representation of the underlying wrapped byte array.

isEmpty
bool isEmpty()

Returns {@code true} if the underlying wrapped byte array is null or empty (zero length), {@code false} otherwise.

Meta