comparison th_crypto.h @ 436:9148bc3fa838

Begin adding Doxygen documentation for some things. Very rudimentary, and most things are not documented yet.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 10 May 2017 21:00:37 +0300
parents 5f9de1d542ee
children 36c50873e02c
comparison
equal deleted inserted replaced
435:468d521240c6 436:9148bc3fa838
5 * This code implements the MD5 message-digest algorithm. 5 * This code implements the MD5 message-digest algorithm.
6 * The algorithm is due to Ron Rivest. This code was 6 * The algorithm is due to Ron Rivest. This code was
7 * written by Colin Plumb in 1993, no copyright is claimed. 7 * written by Colin Plumb in 1993, no copyright is claimed.
8 * This code is in the public domain; do with it what you wish. 8 * This code is in the public domain; do with it what you wish.
9 */ 9 */
10 /// @file
11 /// @brief Cryptography and hash related functions
10 #ifndef TH_CRYPTO_H 12 #ifndef TH_CRYPTO_H
11 #define TH_CRYPTO_H 1 13 #define TH_CRYPTO_H 1
12 14
13 #ifdef HAVE_CONFIG_H 15 #ifdef HAVE_CONFIG_H
14 #include "config.h" 16 #include "config.h"
20 #ifdef __cplusplus 22 #ifdef __cplusplus
21 extern "C" { 23 extern "C" {
22 #endif 24 #endif
23 25
24 26
27 /** @def MD5 digest related defines
28 */
25 #define TH_MD5HASH_LENGTH (16) 29 #define TH_MD5HASH_LENGTH (16)
26 #define TH_MD5HASH_LENGTH_CH (TH_MD5HASH_LENGTH * 2) 30 #define TH_MD5HASH_LENGTH_CH (TH_MD5HASH_LENGTH * 2)
27 31
32
33 /** MD5 digest state structure
34 */
28 typedef struct 35 typedef struct
29 { 36 {
30 uint32_t bits[2]; // Message length in bits, lsw first 37 uint32_t bits[2]; ///< Message length in bits, lsw first
31 uint32_t buf[4]; // Digest buffer 38 uint32_t buf[4]; ///< Digest buffer
32 uint8_t in[64]; // Accumulate block 39 uint8_t in[64]; ///< Accumulate block
33 } th_md5state_t; 40 } th_md5state_t;
34 41
35 typedef uint8_t th_md5hash_t[TH_MD5HASH_LENGTH]; 42 typedef uint8_t th_md5hash_t[TH_MD5HASH_LENGTH]; ///< A structure containing MD5 digest hash
36 43
37 44
38 void th_md5_init(th_md5state_t *ctx); 45 void th_md5_init(th_md5state_t *ctx);
39 void th_md5_append(th_md5state_t *ctx, const uint8_t *buf, size_t len); 46 void th_md5_append(th_md5state_t *ctx, const uint8_t *buf, size_t len);
40 void th_md5_finish(th_md5state_t *ctx, th_md5hash_t digest); 47 void th_md5_finish(th_md5state_t *ctx, th_md5hash_t digest);