com.google.bitcoin.core
Class Sha256Hash

java.lang.Object
  extended by com.google.bitcoin.core.Sha256Hash
All Implemented Interfaces:
Serializable

public class Sha256Hash
extends Object
implements Serializable

A Sha256Hash just wraps a byte[] so that equals and hashcode work correctly, allowing it to be used as keys in a map. It also checks that the length is correct and provides a bit more type safety.

See Also:
Serialized Form

Field Summary
 byte[] hash
           
 
Constructor Summary
Sha256Hash(byte[] hash)
           
 
Method Summary
 boolean equals(Object other)
          Returns true if the hashes are equal.
 int hashCode()
          Hash code of the byte array as calculated by Object.hashCode().
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

hash

public byte[] hash
Constructor Detail

Sha256Hash

public Sha256Hash(byte[] hash)
Method Detail

equals

public boolean equals(Object other)
Returns true if the hashes are equal.

Overrides:
equals in class Object

hashCode

public int hashCode()
Hash code of the byte array as calculated by Object.hashCode(). Note the difference between a SHA256 secure hash and the type of quick/dirty hash used by the Java hashCode method which is designed for use in hash tables.

Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011. All Rights Reserved.