libaaruformat 1.0 Aaru Data Preservation Suite - Format Library

Loading...
Searching...
No Matches
sha256.h
Go to the documentation of this file.
1/*
2 * Public domain / MIT SHA-256 implementation for libaaruformat.
3 *
4 * This code is released into the public domain. If that is not recognized
5 * in your jurisdiction, you may instead treat it under the terms of the
6 * MIT license reproduced below.
7 *
8 * MIT License
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included in all
17 * copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * SOFTWARE.
26 */
27#ifndef LIBAARUFORMAT_SHA256_H
28#define LIBAARUFORMAT_SHA256_H
29
30#include <stdint.h>
31
32#ifdef __cplusplus
33 extern "C"
34{
35#endif
36
37#ifndef SHA256_DIGEST_LENGTH
38#define SHA256_DIGEST_LENGTH 32
39#endif
40
41 typedef struct
42 {
43 uint32_t state[8];
44 uint64_t bitcount; /* total bits processed */
45 uint8_t buffer[64];
46 } sha256_ctx;
47
48#ifdef __cplusplus
49}
50#endif
51
52#endif /* LIBAARUFORMAT_SHA256_H */
sha256_ctx
Definition sha256.h:42
sha256_ctx::bitcount
uint64_t bitcount
Definition sha256.h:44
sha256_ctx::buffer
uint8_t buffer[64]
Definition sha256.h:45
sha256_ctx::state
uint32_t state[8]
Definition sha256.h:43