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


8.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 8.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

– undescribed –

GNUTLS_MAC_SHA3_256

– undescribed –

GNUTLS_MAC_SHA3_384

– undescribed –

GNUTLS_MAC_SHA3_512

– undescribed –

GNUTLS_MAC_MD5_SHA1

Combined MD5+SHA1 MAC placeholder.

GNUTLS_MAC_AEAD

MAC implicit through AEAD cipher.

GNUTLS_MAC_UMAC_96

The UMAC-96 MAC algorithm.

GNUTLS_MAC_UMAC_128

The UMAC-128 MAC algorithm.

Figure 8.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 8.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.

Figure 8.4: The supported hash algorithms.


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