com.cedarsoft.crypt
Class Hash

java.lang.Object
  extended by com.cedarsoft.crypt.Hash
All Implemented Interfaces:
Serializable

public class Hash
extends Object
implements Serializable

Represents a hash value

Author:
Johannes Schneider (js@cedarsoft.com)
See Also:
Serialized Form

Constructor Summary
Hash(Algorithm algorithm, byte[] value)
          Constructor for Hash.
 
Method Summary
 boolean equals(Object o)
          
static Hash fromHex(Algorithm algorithm, String valueAsHex)
          Creates a hash from the given hex value
 Algorithm getAlgorithm()
          Getter for the field algorithm.
 byte[] getValue()
          Getter for the field value.
 String getValueAsHex()
          getValueAsHex
 int hashCode()
          
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Hash

public Hash(@NotNull
            Algorithm algorithm,
            @NotNull
            byte[] value)

Constructor for Hash.

Parameters:
algorithm - a Algorithm object.
value - an array of byte.
Method Detail

getAlgorithm

@NotNull
public Algorithm getAlgorithm()

Getter for the field algorithm.

Returns:
a Algorithm object.

getValueAsHex

@NotNull
public String getValueAsHex()

getValueAsHex

Returns:
a String object.

getValue

@NotNull
public byte[] getValue()

Getter for the field value.

Returns:
an array of byte.

toString

@NonNls
public String toString()

Overrides:
toString in class Object

equals

public boolean equals(Object o)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

fromHex

@NotNull
public static Hash fromHex(@NotNull
                                   Algorithm algorithm,
                                   @NotNull
                                   String valueAsHex)
Creates a hash from the given hex value

Parameters:
algorithm - the algorithm
valueAsHex - the hex value
Returns:
the hash


Copyright © 2010 cedarsoft GmbH. All Rights Reserved.