public final class Sha1Hash extends java.lang.Object implements java.lang.Comparable<Sha1Hash>, java.lang.Cloneable
In libtorrent it is primarily used to hold info-hashes, piece-hashes, peer IDs, node IDs etc.
| Constructor and Description |
|---|
Sha1Hash()
Constructs an all-zero sha1-hash
|
Sha1Hash(byte[] bytes) |
Sha1Hash(sha1_hash h) |
Sha1Hash(java.lang.String hex) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
set the sha1-hash to all zeroes.
|
Sha1Hash |
clone() |
int |
compareTo(Sha1Hash o) |
int |
countLeadingZeroes() |
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
boolean |
isAllZeros()
return true if the sha1-hash is all zero.
|
static Sha1Hash |
max()
returns an all-F sha1-hash.
|
static Sha1Hash |
min()
returns an all-zero sha1-hash.
|
sha1_hash |
swig() |
java.lang.String |
toHex()
Returns the hex representation of this has.
|
java.lang.String |
toString()
Returns an hex representation of this hash.
|
public Sha1Hash(sha1_hash h)
h - native objectpublic Sha1Hash(byte[] bytes)
bytes - hash as an array of bytespublic Sha1Hash(java.lang.String hex)
hex - hex coded representation of the hashpublic Sha1Hash()
public sha1_hash swig()
public void clear()
public boolean isAllZeros()
public int countLeadingZeroes()
public java.lang.String toHex()
This method uses internally the libtorrent to_hex function.
public int compareTo(Sha1Hash o)
compareTo in interface java.lang.Comparable<Sha1Hash>o - public java.lang.String toString()
toHex().toString in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - public int hashCode()
hashCode in class java.lang.Objectpublic Sha1Hash clone()
clone in class java.lang.Objectpublic static Sha1Hash max()
public static Sha1Hash min()