public class SHA1Hash extends SimpleDataStructure
Common uses include:
| Modifier and Type | Field and Description |
|---|---|
static int | HASH_LENGTHHASH_LENGTH. |
_data| Constructor and Description |
|---|
SHA1Hash()Create an empty SHA-1 hash (data is null). |
SHA1Hash(byte[] data)Create a SHA-1 hash from the given data. |
| Modifier and Type | Method and Description |
|---|---|
int | hashCode()a Hash is a hash, so just use the first 4 bytes for speed |
int | length()Hash length in bytes. |
void | readBytes(InputStream in)readBytes. |
void | setData(byte[] data)IllegalArgumentException if data is not 20 bytes (null is ok). |
calculateHash, equals, fromBase64, fromByteArray, getData, read, toBase64, toByteArray, toString, writeBytespublic static final int HASH_LENGTH
public SHA1Hash()
public SHA1Hash(byte[] data)
data - the 20-byte SHA-1 hash dataIllegalArgumentException - if data is not 20 bytes (null is ok)public int hashCode()
hashCode in class SimpleDataStructurepublic int length()
length in class SimpleDataStructurepublic void readBytes(InputStream in) throws DataFormatException, IOException
readBytes in interface DataStructurereadBytes in class SimpleDataStructurein - the stream to readDataFormatException - if the data is improperly formattedIOException - if there was a problem reading the streampublic void setData(byte[] data)
setData in class SimpleDataStructuredata - of correct length, or nullIllegalArgumentException - if data is not 20 bytes (null is ok)