Package gnu.crypto.mac

Provides a basic API for using Message Authentication Code (MAC) algorithms.

Interface Summary

IMac The basic visible methods of any MAC (Message Authentication Code) algorithm.

A MAC provides a way to check the integrity of information transmitted over, or stored in, an unreliable medium, based on a secret key.

Class Summary

BaseMac A base abstract class to facilitate MAC (Message Authentication Code) implementations.
HMac The implementation of the HMAC (Keyed-Hash Message Authentication Code).

HMAC can be used in combination with any iterated cryptographic hash function.

HMacFactory A Factory to instantiate Keyed-Hash Message Authentication Code (HMAC) algorithm instances.
MacFactory A Factory that instantiates instances of every supported Message Authentication Code algorithms, including all HMAC algorithms.
MacInputStream A filtering input stream that computes a MAC (message authentication code) over all data read from the stream.
MacOutputStream A filtering output stream that computes a MAC (message authentication code) over all data written to the stream.
OMAC The One-Key CBC MAC, OMAC.
TMMH16 TMMH is a universal hash function suitable for message authentication in the Wegman-Carter paradigm, as in the Stream Cipher Security Transform.
UHash32 UHASH is a keyed hash function, which takes as input a string of arbitrary length, and produces as output a string of fixed length (such as 8 bytes).
UHash32.L1Hash32 First hash stage of the UHash32 algorithm.
UHash32.L2Hash32 Second hash stage of the UHash32 algorithm. 5.4 L2-HASH-32: Second-layer hash.

  • Input:
    K string of length 24 bytes.
    M string of length less than 2^64 bytes.
  • Returns:
    Y, string of length 16 bytes.
UHash32.L3Hash32 Third hash stage of the UHash32 algorithm.
UMac32 The implementation of the UMAC (Universal Message Authentication Code).

The UMAC algorithms described are parameterized.

Provides a basic API for using Message Authentication Code (MAC) algorithms.

Package overview

A Message Authentication Code, or MAC, is akin to a keyed hash function, in that it produces a fixed-length identifier for variable-length data along with a key. The purpose of a MAC is to guarantee the integrity and authenticity of data, as it is computationally infeasible to fake a MAC without knowledge of the key.

The following diagram shows the important classes participating in this package:

../../..

hash

IMac mac = MacFactory.getInstance("HMAC-SHA-160");
HashMap attributes = new HashMap();
attributes.put(IMac.MAC_KEY_MATERIAL, key_bytes);
attributes.put(IMac.TRUNCATED_SIZE, new Integer(12));
mac.init(attributes);
mac.update(input, 0, input.length);
byte[] result = mac.digest();

Copyright © 2001, 2002, 2003
Free Software Foundation, Inc. All Rights Reserved.