public class SHA1 extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DIGEST_SIZE
size of a SHA-1 digest in octets
|
Constructor and Description |
---|
SHA1()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
cache() |
void |
cached() |
void |
clear()
Clears all data, use reset() to start again.
|
void |
digest()
Completes the digest operation.
|
byte[] |
digest(byte[] source) |
byte[] |
digest(byte[] source,
int offset,
int length) |
boolean |
equals(byte[] otherDigest) |
boolean |
equals(byte[] otherDigest,
int offset,
int length) |
static SHA1 |
getCached() |
byte[] |
getDigest()
Retrieves the digest.
|
int |
getDigest(byte[] buf,
int nOfs)
Retrieves the digest into an existing buffer.
|
void |
reset()
Initializes (or resets) the hasher for a new session.
|
String |
toString()
makes a binhex string representation of the current digest
|
void |
update(byte bB)
Adds a single byte to the digest.
|
void |
update(byte[] data)
Deprecated.
use update(byte[], int, int) instead
|
void |
update(byte[] data,
int nOfs,
int nLen)
Adds a portion of a byte array to the digest.
|
void |
update(String sData)
Deprecated.
don't use this method anymore (it's not clean), you might
want to try update(sData.getBytes()) instead
|
public static final int DIGEST_SIZE
public void cached()
public static SHA1 getCached()
public void cache()
public void clear()
public void reset()
public void update(byte bB)
bB
- the byte to addpublic void update(byte[] data)
data
- the data to addpublic void update(byte[] data, int nOfs, int nLen)
data
- the data to addnOfs
- the offset of the bytes in the data array.nLen
- the number of bytes to add.public void update(String sData)
sData
- the string to addpublic byte[] digest(byte[] source, int offset, int length)
public byte[] digest(byte[] source)
public void digest()
public byte[] getDigest()
public boolean equals(byte[] otherDigest, int offset, int length)
public boolean equals(byte[] otherDigest)
public int getDigest(byte[] buf, int nOfs)
buf
- buffer to store the digst intonOfs
- where to write to