2016-04-03 00:05:40 +02:00
|
|
|
/*
|
|
|
|
* Based on the SHA-1 C implementation by Steve Reid <steve@edmweb.com>
|
|
|
|
* 100% Public Domain
|
|
|
|
*/
|
|
|
|
|
2016-08-13 05:05:54 +02:00
|
|
|
#pragma once
|
|
|
|
#define HAVE_WSOCKD_SHA1_H
|
2016-04-03 00:05:40 +02:00
|
|
|
|
|
|
|
#define SHA1_BLOCK_LENGTH 64
|
|
|
|
#define SHA1_DIGEST_LENGTH 20
|
|
|
|
|
2016-08-13 05:05:54 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2016-04-03 00:05:40 +02:00
|
|
|
typedef struct {
|
|
|
|
uint32_t state[5];
|
|
|
|
uint64_t count;
|
|
|
|
uint8_t buffer[SHA1_BLOCK_LENGTH];
|
|
|
|
} SHA1;
|
|
|
|
|
|
|
|
void sha1_init(SHA1 *sha1);
|
|
|
|
void sha1_update(SHA1 *sha1, const uint8_t *data, size_t length);
|
|
|
|
void sha1_final(SHA1 *sha1, uint8_t digest[SHA1_DIGEST_LENGTH]);
|
|
|
|
|
2016-08-13 05:05:54 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
} // extern "C"
|
|
|
|
#endif
|