This module provides optional support for message digest algorithms. It is intended to comply with RFC 3174. More...
Macros | |
#define | MAIN_ERR_PREFIX "DIGEST: " |
Message prefix for DIGEST module. | |
#define | MAIN_ERR_PREFIX "DIGEST: " |
Enumerations | |
enum | digest_alg { DIGEST_ALG_SHA1_160, DIGEST_ALG_SHA2_256 } |
Functions | |
int | digest_sha1_160 (const char *text, size_t text_len, unsigned char *md) |
Secure Hash Algorithm SHA1-160. More... | |
int | digest_sha2_256 (const char *text, size_t text_len, unsigned char *md) |
Secure Hash Algorithm SHA2-256. More... | |
void | digest_init (void) |
Initialize message digest module. | |
void | digest_exit (void) |
Shutdown message digest module. | |
int | digest_randomart (const char *prefix, const char *buf, size_t len) |
Create randomart image of a key. More... | |
Lenght of message digests | |
#define | DIGEST_SHA1_160_LEN (size_t) 20 |
160 bit | |
#define | DIGEST_SHA2_256_LEN (size_t) 32 |
256 bit | |
Size of randomart images | |
#define | DIGEST_RA_X (size_t) 17 |
Field width: 17 units. | |
#define | DIGEST_RA_Y (size_t) 9 |
Field height: 9 units. | |
This module provides optional support for message digest algorithms. It is intended to comply with RFC 3174.
int digest_randomart | ( | const char * | prefix, |
const char * | buf, | ||
size_t | len | ||
) |
Create randomart image of a key.
[in] | prefix | Prefix to prepend for each output line |
[in] | buf | Pointer to data buffer |
[in] | len | Length of data in buffer |
The data from buf is hashed with the SHA2-256 algorithm to create a fingerprint. The first 16 bytes of this fingerprint are used to create a randomart image with the drunken bishop algorithm.
Definition at line 180 of file drunken_bishop.c.
References digest_sha2_256(), DIGEST_SHA2_256_LEN, and enc_mime_encode_base64().
int digest_sha1_160 | ( | const char * | text, |
size_t | text_len, | ||
unsigned char * | md | ||
) |
Secure Hash Algorithm SHA1-160.
[in] | text | Message |
[in] | text_len | Message length |
[out] | md | Message digest |
The values of paramater text_len must represent bytes.
On success, the result is written to md and has a length of DIGEST_SHA1_160_LEN
bytes.
Definition at line 159 of file digest.c.
Referenced by core_get_cancel_lock().
int digest_sha2_256 | ( | const char * | text, |
size_t | text_len, | ||
unsigned char * | md | ||
) |
Secure Hash Algorithm SHA2-256.
[in] | text | Message |
[in] | text_len | Message length |
[out] | md | Message digest |
The values of paramater text_len must represent bytes.
On success, the result is written to md and has a length of DIGEST_SHA2_256_LEN
bytes.
Definition at line 182 of file digest.c.
Referenced by core_get_cancel_lock(), and digest_randomart().