public final class Sha1
extends java.lang.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 |
---|---|
byte[] |
digest()
Finishes computing the digest & then returns it.
|
byte[] |
digest(byte[] input)
Does a final update, with the passed input, then computes the SHA1 digest, which is returned.
|
static byte[] |
hmac(byte[] key,
byte[] message)
Compute the HMAC-SHA1 for the specified message & key.
|
void |
reset()
Initializes (or resets) the hasher for a new session.
|
void |
update(byte bB)
Adds a single byte to the digest.
|
void |
update(byte[] data)
Adds a byte array to the digest.
|
void |
update(byte[] data,
int nOfs,
int nLen)
Adds a portion of a byte array to the digest.
|
public static final int DIGEST_SIZE
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 addpublic byte[] digest()
public byte[] digest(byte[] input)
input
- data to updatepublic static byte[] hmac(byte[] key, byte[] message)
key
- HMAC keymessage
- message