Go to the source code of this file.
|
void | sha2_starts (sha2_context *ctx) |
| SHA-256 context setup.
|
|
void | sha2_update (sha2_context *ctx, unsigned char *input, int ilen) |
| SHA-256 process buffer.
|
|
void | sha2_finish (sha2_context *ctx, unsigned char output[32]) |
| SHA-256 final digest.
|
|
void | sha2_csum (unsigned char *input, int ilen, unsigned char output[32]) |
| Output = SHA-256( input buffer )
|
|
int | sha2_file (char *path, unsigned char output[32]) |
| Output = SHA-256( file contents )
|
|
void | sha2_hmac (unsigned char *key, int keylen, unsigned char *input, int ilen, unsigned char output[32]) |
| Output = HMAC-SHA-256( input buffer, hmac key )
|
|
int | sha2_self_test (void) |
| Checkup routine.
|
|
◆ sha2_csum()
void sha2_csum |
( |
unsigned char * |
input, |
|
|
int |
ilen, |
|
|
unsigned char |
output[32] |
|
) |
| |
Output = SHA-256( input buffer )
- Parameters
-
input | buffer holding the data |
ilen | length of the input data |
output | SHA-256 checksum result |
◆ sha2_file()
int sha2_file |
( |
char * |
path, |
|
|
unsigned char |
output[32] |
|
) |
| |
Output = SHA-256( file contents )
- Parameters
-
path | input file name |
output | SHA-256 checksum result |
- Returns
- 0 if successful, or 1 if fopen failed
◆ sha2_finish()
void sha2_finish |
( |
sha2_context * |
ctx, |
|
|
unsigned char |
output[32] |
|
) |
| |
SHA-256 final digest.
- Parameters
-
ctx | SHA-256 context |
output | SHA-256 checksum result |
◆ sha2_hmac()
void sha2_hmac |
( |
unsigned char * |
key, |
|
|
int |
keylen, |
|
|
unsigned char * |
input, |
|
|
int |
ilen, |
|
|
unsigned char |
output[32] |
|
) |
| |
Output = HMAC-SHA-256( input buffer, hmac key )
- Parameters
-
key | HMAC secret key |
keylen | length of the HMAC key |
input | buffer holding the data |
ilen | length of the input data |
output | HMAC-SHA-256 result |
◆ sha2_self_test()
int sha2_self_test |
( |
void |
| ) |
|
Checkup routine.
- Returns
- 0 if successful, or 1 if the test failed
◆ sha2_starts()
SHA-256 context setup.
- Parameters
-
ctx | SHA-256 context to be initialized |
◆ sha2_update()
void sha2_update |
( |
sha2_context * |
ctx, |
|
|
unsigned char * |
input, |
|
|
int |
ilen |
|
) |
| |
SHA-256 process buffer.
- Parameters
-
ctx | SHA-256 context |
input | buffer holding the data |
ilen | length of the input data |