public class Sha256Hash extends Object implements Serializable, Comparable
Modifier and Type | Field and Description |
---|---|
static Sha256Hash |
ZERO_HASH |
Constructor and Description |
---|
Sha256Hash(byte[] rawHashBytes)
Creates a Sha256Hash by wrapping the given byte array.
|
Sha256Hash(String hexString)
Creates a Sha256Hash by decoding the given hex string.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Object o) |
static Sha256Hash |
create(byte[] contents)
Calculates the (one-time) hash of contents and returns it as a new wrapped hash.
|
static Sha256Hash |
createDouble(byte[] contents)
Calculates the hash of the hash of the contents.
|
Sha256Hash |
duplicate() |
boolean |
equals(Object other)
Returns true if the hashes are equal.
|
byte[] |
getBytes() |
int |
hashCode()
Hash code of the byte array as calculated by
Object.hashCode() . |
static Sha256Hash |
hashFileContents(File f)
Returns a hash of the given files contents.
|
BigInteger |
toBigInteger()
Returns the bytes interpreted as a positive integer.
|
String |
toString() |
public static final Sha256Hash ZERO_HASH
public Sha256Hash(byte[] rawHashBytes)
public Sha256Hash(String hexString)
public static Sha256Hash create(byte[] contents)
public static Sha256Hash createDouble(byte[] contents)
public static Sha256Hash hashFileContents(File f) throws IOException
IOException
public boolean equals(Object other)
public int hashCode()
Object.hashCode()
. Note the difference between a SHA256
secure bytes and the type of quick/dirty bytes used by the Java hashCode method which is designed for use in
bytes tables.public BigInteger toBigInteger()
public byte[] getBytes()
public Sha256Hash duplicate()
public int compareTo(Object o)
compareTo
in interface Comparable
Copyright © 2014. All rights reserved.