Modifier and Type | Field and Description |
---|---|
private int |
blockLength |
private static java.util.Hashtable<java.lang.String,java.lang.Integer> |
blockLengths |
private Digest |
digest |
private int |
digestSize |
private byte[] |
inputPad |
private static byte |
IPAD |
private Memoable |
ipadState |
private static byte |
OPAD |
private Memoable |
opadState |
private byte[] |
outputBuf |
Modifier | Constructor and Description |
---|---|
|
HMac(Digest digest)
Base constructor for one of the standard digest algorithms that the
byteLength of the algorithm is know for.
|
private |
HMac(Digest digest,
int byteLength) |
Modifier and Type | Method and Description |
---|---|
int |
doFinal(byte[] out,
int outOff)
Compute the final stage of the MAC writing the output to the out
parameter.
|
java.lang.String |
getAlgorithmName()
Return the name of the algorithm the MAC implements.
|
private static int |
getByteLength(Digest digest) |
int |
getMacSize()
Return the block size for this MAC (in bytes).
|
Digest |
getUnderlyingDigest() |
void |
init(CipherParameters params)
Initialise the MAC.
|
void |
reset()
Reset the mac generator.
|
void |
update(byte in)
add a single byte to the mac for processing.
|
void |
update(byte[] in,
int inOff,
int len) |
private static void |
xorPad(byte[] pad,
int len,
byte n) |
private static final byte IPAD
private static final byte OPAD
private Digest digest
private int digestSize
private int blockLength
private Memoable ipadState
private Memoable opadState
private byte[] inputPad
private byte[] outputBuf
private static java.util.Hashtable<java.lang.String,java.lang.Integer> blockLengths
public HMac(Digest digest)
digest
- the digest.private HMac(Digest digest, int byteLength)
private static int getByteLength(Digest digest)
public java.lang.String getAlgorithmName()
Mac
getAlgorithmName
in interface Mac
public Digest getUnderlyingDigest()
public void init(CipherParameters params)
Mac
public int getMacSize()
Mac
getMacSize
in interface Mac
public void update(byte in)
Mac
public void update(byte[] in, int inOff, int len)
public int doFinal(byte[] out, int outOff)
Mac
doFinal leaves the MAC in the same state it was after the last init.
private static void xorPad(byte[] pad, int len, byte n)