-
Notifications
You must be signed in to change notification settings - Fork 2
/
sha2.h
66 lines (55 loc) · 2.5 KB
/
sha2.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
+----------------------------------------------------------------------+
| sha2.h: APR sha256 include file |
+----------------------------------------------------------------------+
| Licensed under the Apache License, Version 2.0 (the "License"); you |
| may not use this file except in compliance with the License. You may |
| obtain a copy of the License at |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| implied. See the License for the specific language governing |
| permissions and limitations under the License. |
+----------------------------------------------------------------------+
| Author: Aaron D. Gifford <[email protected]> |
+----------------------------------------------------------------------+
| A licence was granted to the ASF by Aaron on 4 November 2003. |
+----------------------------------------------------------------------+
*/
#ifndef __SHA2_H__
#define __SHA2_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "apr.h"
/*** SHA-256 Various Length Definitions ***********************/
#define SHA256_BLOCK_LENGTH 64
#define SHA256_DIGEST_LENGTH 32
#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1)
/*** SHA-256/384/512 Context Structures *******************************/
typedef struct _SHA256_CTX {
apr_uint32_t state[8];
apr_uint64_t bitcount;
apr_byte_t buffer[SHA256_BLOCK_LENGTH];
} SHA256_CTX;
/*** SHA-256/384/512 Function Prototypes ******************************/
void apr__SHA256_Init(SHA256_CTX *);
void apr__SHA256_Update(SHA256_CTX *, const apr_byte_t *, size_t);
void apr__SHA256_Final(apr_byte_t [SHA256_DIGEST_LENGTH], SHA256_CTX *);
char* apr__SHA256_End(SHA256_CTX *, char [SHA256_DIGEST_STRING_LENGTH]);
char* apr__SHA256_Data(const apr_byte_t *, size_t,
char [SHA256_DIGEST_STRING_LENGTH]);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __SHA2_H__ */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/