Class Sha256Hash
java.lang.Object
com.frostwire.jlibtorrent.Sha256Hash
- All Implemented Interfaces:
Cloneable,Comparable<Sha256Hash>
SHA-256 digest or any other kind of 32 byte sequence.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an all-zero sha256-hashSha256Hash(byte[] bytes) Sha256Hash(String hex) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()set the sha256-hash to all zeroes.clone()intintbooleaninthashCode()booleanreturn true if the sha256-hash is all zero.static Sha256Hashmax()returns an all-F sha256-hash.static Sha256Hashmin()returns an all-zero sha256-hash.swig()toHex()Returns the hex representation of this has.toString()Returns an hex representation of this hash.
-
Constructor Details
-
Sha256Hash
- Parameters:
h- native object
-
Sha256Hash
public Sha256Hash()Constructs an all-zero sha256-hash -
Sha256Hash
public Sha256Hash(byte[] bytes) - Parameters:
bytes- hash as an array of bytes
-
Sha256Hash
- Parameters:
hex- hex coded representation of the hash
-
-
Method Details
-
clear
public void clear()set the sha256-hash to all zeroes. -
isAllZeros
public boolean isAllZeros()return true if the sha256-hash is all zero.- Returns:
- true if zero
-
countLeadingZeroes
public int countLeadingZeroes()- Returns:
- the number of leading zeroes
-
toHex
Returns the hex representation of this has.This method uses internally the libtorrent to_hex function.
- Returns:
- the hex representation
-
compareTo
- Specified by:
compareToin interfaceComparable<Sha256Hash>- Parameters:
o-- Returns:
-
toString
-
equals
-
hashCode
-
clone
-
max
returns an all-F sha256-hash. i.e. the maximum value representable by a 256 bit number (32 bytes). This is a static member function.- Returns:
- the maximum number
-
min
returns an all-zero sha256-hash. i.e. the minimum value representable by a 256 bit number (32 bytes). This is a static member function.- Returns:
- the minimum number (zero)
-
swig
-