nettle: nettle_hash abstraction

1 
1 6.1.3 The ‘struct nettle_hash’ abstraction
1 ------------------------------------------
1 
1 Nettle includes a struct including information about the supported hash
1 functions.  It is defined in ‘<nettle/nettle-meta.h>’, and is used by
1 Nettle’s implementation of HMAC (⇒Keyed hash functions).
1 
1  -- Meta struct: ‘struct nettle_hash’ name context_size digest_size
1           block_size init update digest
1      The last three attributes are function pointers, of types
1      ‘nettle_hash_init_func *’, ‘nettle_hash_update_func *’, and
1      ‘nettle_hash_digest_func *’.  The first argument to these functions
1      is ‘void *’ pointer to a context struct, which is of size
1      ‘context_size’.
1 
1  -- Constant Struct: struct nettle_hash nettle_md2
1  -- Constant Struct: struct nettle_hash nettle_md4
1  -- Constant Struct: struct nettle_hash nettle_md5
1  -- Constant Struct: struct nettle_hash nettle_ripemd160
1  -- Constant Struct: struct nettle_hash nettle_sha1
1  -- Constant Struct: struct nettle_hash nettle_sha224
1  -- Constant Struct: struct nettle_hash nettle_sha256
1  -- Constant Struct: struct nettle_hash nettle_sha384
1  -- Constant Struct: struct nettle_hash nettle_sha512
1  -- Constant Struct: struct nettle_hash nettle_sha3_256
1  -- Constant Struct: struct nettle_hash nettle_gosthash94
1      These are all the hash functions that Nettle implements.
1 
1    Nettle also exports a list of all these hashes.
1 
1  -- Function: const struct nettle_hash **nettle_get_hashes(void)
1      Returns a NULL-terminated list of pointers to supported hash
1      functions.  This list can be used to dynamically enumerate or
1      search the supported algorithms.
1 
1  -- Macro: nettle_hashes
1      A macro expanding to a call to nettle_get_hashes, so that one could
1      write, e.g., ‘nettle_hashes[0]->name’ for the name of the first
1      hash function on the list.  In earlier versions, this was not a
1      macro but the actual array of pointers.  However, referring
1      directly to the array makes the array size leak into the ABI in
1      some cases.
1