public class Sha256Hash extends Object implements Serializable, Comparable<Sha256Hash>
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(Sha256Hash 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 o) |
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 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(Sha256Hash o)
compareTo
in interface Comparable<Sha256Hash>
Copyright © 2014. All rights reserved.