3 @section Hash functions
4 A hash function is an algorithm to map an arbitrary long message (in the form
5 of a bit string) to a fixed length message digest or hash value.
6 The hash function aims to be collision free, which means that it is not
7 practicable to find two messages with the same hash value (although this
8 collision must exist). Also it should not be practicable to construct a
9 message which maps to a given hash value.
11 @subsection List of available hash functions
12 The following hash functions are currently implemented:
15 @item BlueMidnightWish
27 @subsection High frequent parameters:
32 128 bits, 160 bits, 224 bits, 256 bits, 384 bits, 512 bits
36 @subsection Parts of a hash function
38 @item initialization function
39 @item compression algorithm
40 @item finalization function
43 @subsection hash function API
44 The API is not always consistent due to the fact that we tried to optimize the
45 code for size (flash, heap and stack) and speed (runtime of the different
47 Generally the API of the implemented block ciphers consists of:
50 function, which implements the initialisation of the context
52 function, which implements the compression algorithm
54 function, which implements the the padding algorithm
56 function, which turns a context into an actual hash value
58 context type, which can contains the state of a hashing process
61 @subsubsection @code{*_init} function
62 The @code{*_init} function generally takes a pointer to the context as parameter.
63 This function initializes the context with algorithm specific values.
65 @subsubsection @code{*_nextBlock} function
66 The @code{*_nextBlock} function is the core of each hash function. It updates the hash
67 state with a given message block. So this function uses a context pointer and
68 a message pointer as parameters. The size of a message block is fixed for each
69 hash function (mostly 512 bit). For the last block of a messages which may be
70 smaller than the blocksize you have to use the @code{*_lastBlock} function described
73 @subsubsection @code{*_lastBlock} function
74 The @code{*_lastBlock} function finalizes the context with the last bits of a
75 message. Since the last block is not required to have the blocksize you have
76 to specify the length of the last block (normally in bits). This function
77 performs the padding and final processing.
79 @subsubsection @code{*_ctx2hash} function
80 The @code{*_ctx2hash} function turns a given hash context into an actual hash value.
81 If multiple sized hash value may be created from a context it is necessary to
82 give the the size of the hash value as parameter.
85 @subsection Hash function abstraction layer (HFAL)