2449.1.4
by Brian Aker
Complete update of libdrizzle |
1 |
#pragma once
|
2 |
||
2244.1.1
by Monty Taylor
Split libdrizzle into 1.0 and 2.0. Applied the C++ changes to 2.0 branch. |
3 |
/**
|
4 |
* @file
|
|
5 |
* @brief SHA1 Declarations
|
|
6 |
*/
|
|
7 |
||
8 |
#ifdef __cplusplus
|
|
9 |
extern "C" { |
|
10 |
#endif
|
|
11 |
||
12 |
/**
|
|
13 |
* @addtogroup sha1 SHA-1 in C
|
|
14 |
*
|
|
15 |
* Copyright (C) 2010 nobody (this is public domain)
|
|
16 |
*
|
|
17 |
* This file is based on public domain code.
|
|
18 |
* Initial source code is in the public domain,
|
|
19 |
* so clarified by Steve Reid <steve@edmweb.com>
|
|
20 |
*
|
|
21 |
* @{
|
|
22 |
*/
|
|
23 |
||
24 |
#define SHA1_BLOCK_LENGTH 64
|
|
25 |
#define SHA1_DIGEST_LENGTH 20
|
|
26 |
#define SHA1_DIGEST_STRING_LENGTH (SHA1_DIGEST_LENGTH * 2 + 1)
|
|
27 |
||
28 |
typedef struct { |
|
29 |
uint32_t state[5]; |
|
30 |
uint64_t count; |
|
31 |
uint8_t buffer[SHA1_BLOCK_LENGTH]; |
|
32 |
} SHA1_CTX; |
|
33 |
||
34 |
void SHA1Init(SHA1_CTX *); |
|
35 |
void SHA1Pad(SHA1_CTX *); |
|
36 |
void SHA1Transform(uint32_t [5], const uint8_t [SHA1_BLOCK_LENGTH]); |
|
37 |
void SHA1Update(SHA1_CTX *, const uint8_t *, size_t); |
|
38 |
void SHA1Final(uint8_t [SHA1_DIGEST_LENGTH], SHA1_CTX *); |
|
39 |
||
40 |
/** @} */
|
|
41 |
||
42 |
#ifdef __cplusplus
|
|
43 |
}
|
|
44 |
#endif
|