blob: 8fdd632cd374a5b281cf106126c2b8cf6941f9f3 [file] [log] [blame]
James Kuszmaul82f6c042021-01-17 11:30:16 -08001/**
2 * @file re_sha.h Interface to SHA (Secure Hash Standard) functions
3 *
4 * Copyright (C) 2010 Creytiv.com
5 */
6
7
8#ifdef USE_OPENSSL
9#include <openssl/sha.h>
10#else
11
12/* public api for steve reid's public domain SHA-1 implementation */
13/* this file is in the public domain */
14
15/** SHA-1 Context */
16typedef struct {
17 uint32_t state[5]; /**< Context state */
18 uint32_t count[2]; /**< Counter */
19 uint8_t buffer[64]; /**< SHA-1 buffer */
20} SHA1_CTX;
21
22/** SHA-1 Context (OpenSSL compat) */
23typedef SHA1_CTX SHA_CTX;
24
25/** SHA-1 Digest size in bytes */
26#define SHA1_DIGEST_SIZE 20
27/** SHA-1 Digest size in bytes (OpenSSL compat) */
28#define SHA_DIGEST_LENGTH SHA1_DIGEST_SIZE
29
30void SHA1_Init(SHA1_CTX* context);
31void SHA1_Update(SHA1_CTX* context, const void *p, size_t len);
32void SHA1_Final(uint8_t digest[SHA1_DIGEST_SIZE], SHA1_CTX* context);
33
34#endif