gnu.crypto.mac
public class TMMH16 extends BaseMac implements Cloneable
TMMH is a universal hash function suitable for message authentication in the Wegman-Carter paradigm, as in the Stream Cipher Security Transform. It is simple, quick, and especially appropriate for Digital Signal Processors and other processors with a fast multiply operation, though a straightforward implementation requires storage equal in length to the largest message to be hashed.
TMMH is a simple hash function which maps a key and a message to a hash value. There are two versions of TMMH: TMMH/16 and TMMH/32. TMMH can be used as a message authentication code, as described in Section 5 (see References).
The key, message, and hash value are all octet strings, and the lengths of
these quantities are denoted as KEY_LENGTH
,
MESSAGE_LENGTH
, and TAG_LENGTH
, respectively. The
values of KEY_LENGTH
and TAG_LENGTH
The parameter MAX_HASH_LENGTH
, which denotes the maximum
value which MESSAGE_LENGTH
may take, is equal to
KEY_LENGTH - TAG_LENGTH
.
References:
Version: $Revision: 1.6 $
Field Summary | |
---|---|
static String | KEYSTREAM |
static String | PREFIX |
static String | TAG_LENGTH |
Constructor Summary | |
---|---|
TMMH16() Trivial 0-arguments constructor. |
Method Summary | |
---|---|
byte[] | digest() |
byte[] | digest(IRandom prng) Similar to the same method with no arguments, but uses the designated random number generator to compute needed keying material. |
void | init(Map attributes) |
int | macSize() |
void | reset() |
boolean | selfTest() |
void | update(byte b) |
void | update(byte[] b, int offset, int len) |
void | update(byte b, IRandom prng) Similar to the same method with one argument, but uses the designated random number generator to compute needed keying material. |
void | update(byte[] b, int offset, int len, IRandom prng) Similar to the same method with three arguments, but uses the designated random number generator to compute needed keying material. |
Similar to the same method with no arguments, but uses the designated random number generator to compute needed keying material.
Parameters: prng the source of randomness to use.
Returns: the final result of the algorithm.
Similar to the same method with one argument, but uses the designated random number generator to compute needed keying material.
Parameters: b the byte to process. prng the source of randomness to use.
Similar to the same method with three arguments, but uses the designated random number generator to compute needed keying material.
Parameters: b the byte array to process. offset the starting offset in b
to start considering
the bytes to process. len the number of bytes in b
starting from
offset
to process. prng the source of randomness to use.