Next: , Previous: , Up: Using GnuTLS as a cryptographic library   [Contents][Index]


9.4 Hash and MAC functions

The available operations to access hash functions and hash-MAC (HMAC) algorithms are shown below. HMAC algorithms provided keyed hash functionality. The supported MAC and HMAC algorithms are listed in Figure 9.3. Note that, despite the hmac part in the name of the MAC functions listed below, they can be used either for HMAC or MAC operations.

GNUTLS_MAC_UNKNOWN

Unknown MAC algorithm.

GNUTLS_MAC_NULL

NULL MAC algorithm (empty output).

GNUTLS_MAC_MD5

HMAC-MD5 algorithm.

GNUTLS_MAC_SHA1

HMAC-SHA-1 algorithm.

GNUTLS_MAC_RMD160

HMAC-RMD160 algorithm.

GNUTLS_MAC_MD2

HMAC-MD2 algorithm.

GNUTLS_MAC_SHA256

HMAC-SHA-256 algorithm.

GNUTLS_MAC_SHA384

HMAC-SHA-384 algorithm.

GNUTLS_MAC_SHA512

HMAC-SHA-512 algorithm.

GNUTLS_MAC_SHA224

HMAC-SHA-224 algorithm.

GNUTLS_MAC_SHA3_224

Reserved; unimplemented.

GNUTLS_MAC_SHA3_256

Reserved; unimplemented.

GNUTLS_MAC_SHA3_384

Reserved; unimplemented.

GNUTLS_MAC_SHA3_512

Reserved; unimplemented.

GNUTLS_MAC_MD5_SHA1

Combined MD5+SHA1 MAC placeholder.

GNUTLS_MAC_GOSTR_94

HMAC GOST R 34.11-94 algorithm.

GNUTLS_MAC_STREEBOG_256

HMAC GOST R 34.11-2001 (Streebog) algorithm, 256 bit.

GNUTLS_MAC_STREEBOG_512

HMAC GOST R 34.11-2001 (Streebog) algorithm, 512 bit.

GNUTLS_MAC_AEAD

MAC implicit through AEAD cipher.

GNUTLS_MAC_UMAC_96

The UMAC-96 MAC algorithm (requires nonce).

GNUTLS_MAC_UMAC_128

The UMAC-128 MAC algorithm (requires nonce).

GNUTLS_MAC_AES_CMAC_128

The AES-CMAC-128 MAC algorithm.

GNUTLS_MAC_AES_CMAC_256

The AES-CMAC-256 MAC algorithm.

GNUTLS_MAC_AES_GMAC_128

The AES-GMAC-128 MAC algorithm (requires nonce).

GNUTLS_MAC_AES_GMAC_192

The AES-GMAC-192 MAC algorithm (requires nonce).

GNUTLS_MAC_AES_GMAC_256

The AES-GMAC-256 MAC algorithm (requires nonce).

GNUTLS_MAC_GOST28147_TC26Z_IMIT

The GOST 28147-89 working in IMIT mode with TC26 Z S-box.

GNUTLS_MAC_SHAKE_128

Reserved; unimplemented.

GNUTLS_MAC_SHAKE_256

Reserved; unimplemented.

GNUTLS_MAC_MAGMA_OMAC

GOST R 34.12-2015 (Magma) in OMAC (CMAC) mode.

GNUTLS_MAC_KUZNYECHIK_OMAC

GOST R 34.12-2015 (Kuznyechik) in OMAC (CMAC) mode.

Figure 9.3: The supported MAC and HMAC algorithms.

int gnutls_hmac_init (gnutls_hmac_hd_t * dig, gnutls_mac_algorithm_t algorithm, const void * key, size_t keylen)
int gnutls_hmac (gnutls_hmac_hd_t handle, const void * ptext, size_t ptext_len)
void gnutls_hmac_output (gnutls_hmac_hd_t handle, void * digest)
void gnutls_hmac_deinit (gnutls_hmac_hd_t handle, void * digest)
unsigned gnutls_hmac_get_len (gnutls_mac_algorithm_t algorithm)
int gnutls_hmac_fast (gnutls_mac_algorithm_t algorithm, const void * key, size_t keylen, const void * ptext, size_t ptext_len, void * digest)

The available functions to access hash functions are shown below. The supported hash functions are shown in Figure 9.4.

int gnutls_hash_init (gnutls_hash_hd_t * dig, gnutls_digest_algorithm_t algorithm)
int gnutls_hash (gnutls_hash_hd_t handle, const void * ptext, size_t ptext_len)
void gnutls_hash_output (gnutls_hash_hd_t handle, void * digest)
void gnutls_hash_deinit (gnutls_hash_hd_t handle, void * digest)
unsigned gnutls_hash_get_len (gnutls_digest_algorithm_t algorithm)
int gnutls_hash_fast (gnutls_digest_algorithm_t algorithm, const void * ptext, size_t ptext_len, void * digest)
int gnutls_fingerprint (gnutls_digest_algorithm_t algo, const gnutls_datum_t * data, void * result, size_t * result_size)
GNUTLS_DIG_UNKNOWN

Unknown hash algorithm.

GNUTLS_DIG_NULL

NULL hash algorithm (empty output).

GNUTLS_DIG_MD5

MD5 algorithm.

GNUTLS_DIG_SHA1

SHA-1 algorithm.

GNUTLS_DIG_RMD160

RMD160 algorithm.

GNUTLS_DIG_MD2

MD2 algorithm.

GNUTLS_DIG_SHA256

SHA-256 algorithm.

GNUTLS_DIG_SHA384

SHA-384 algorithm.

GNUTLS_DIG_SHA512

SHA-512 algorithm.

GNUTLS_DIG_SHA224

SHA-224 algorithm.

GNUTLS_DIG_SHA3_224

SHA3-224 algorithm.

GNUTLS_DIG_SHA3_256

SHA3-256 algorithm.

GNUTLS_DIG_SHA3_384

SHA3-384 algorithm.

GNUTLS_DIG_SHA3_512

SHA3-512 algorithm.

GNUTLS_DIG_MD5_SHA1

Combined MD5+SHA1 algorithm.

GNUTLS_DIG_GOSTR_94

GOST R 34.11-94 algorithm.

GNUTLS_DIG_STREEBOG_256

GOST R 34.11-2001 (Streebog) algorithm, 256 bit.

GNUTLS_DIG_STREEBOG_512

GOST R 34.11-2001 (Streebog) algorithm, 512 bit.

GNUTLS_DIG_SHAKE_128

Reserved; unimplemented.

GNUTLS_DIG_SHAKE_256

Reserved; unimplemented.

Figure 9.4: The supported hash algorithms.


Next: , Previous: , Up: Using GnuTLS as a cryptographic library   [Contents][Index]