GNU libmicrohttpd
1.0.6
Toggle main menu visibility
Loading...
Searching...
No Matches
sha512_256.h
Go to the documentation of this file.
1
/*
2
This file is part of GNU libmicrohttpd
3
Copyright (C) 2022 Evgeny Grin (Karlson2k)
4
5
GNU libmicrohttpd is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Lesser General Public
7
License as published by the Free Software Foundation; either
8
version 2.1 of the License, or (at your option) any later version.
9
10
This library is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Lesser General Public License for more details.
14
15
You should have received a copy of the GNU Lesser General Public
16
License along with this library.
17
If not, see <http://www.gnu.org/licenses/>.
18
*/
19
25
26
#ifndef MHD_SHA512_256_H
27
#define MHD_SHA512_256_H 1
28
29
#include "
mhd_options.h
"
30
#include <stdint.h>
31
#ifdef HAVE_STDDEF_H
32
#include <stddef.h>
/* for size_t */
33
#endif
/* HAVE_STDDEF_H */
34
35
39
#define SHA512_256_WORD_SIZE_BITS 64
40
44
#define SHA512_256_BYTES_IN_WORD (SHA512_256_WORD_SIZE_BITS / 8)
45
50
#define SHA512_256_HASH_SIZE_WORDS 8
51
56
#define SHA512_256_DIGEST_SIZE_WORDS (SHA512_256_HASH_SIZE_WORDS / 2)
57
62
#define SHA512_256_DIGEST_SIZE \
63
(SHA512_256_DIGEST_SIZE_WORDS * SHA512_256_BYTES_IN_WORD)
64
68
#define SHA512_256_DIGEST_STRING_SIZE ((SHA512_256_DIGEST_SIZE) * 2 + 1)
69
73
#define SHA512_256_BLOCK_SIZE_BITS 1024
74
78
#define SHA512_256_BLOCK_SIZE (SHA512_256_BLOCK_SIZE_BITS / 8)
79
83
#define SHA512_256_BLOCK_SIZE_WORDS \
84
(SHA512_256_BLOCK_SIZE_BITS / SHA512_256_WORD_SIZE_BITS)
85
86
90
struct
Sha512_256Ctx
91
{
92
uint64_t
H
[
SHA512_256_HASH_SIZE_WORDS
];
93
uint64_t
buffer
[
SHA512_256_BLOCK_SIZE_WORDS
];
97
uint64_t
count
;
102
uint64_t
count_bits_hi
;
103
};
104
110
void
111
MHD_SHA512_256_init
(
struct
Sha512_256Ctx
*ctx);
112
113
121
void
122
MHD_SHA512_256_update
(
struct
Sha512_256Ctx
*ctx,
123
const
uint8_t *
data
,
124
size_t
length);
125
126
133
void
134
MHD_SHA512_256_finish
(
struct
Sha512_256Ctx
*ctx,
135
uint8_t digest[
SHA512_256_DIGEST_SIZE
]);
136
137
#endif
/* MHD_SHA512_256_H */
mhd_options.h
additional automatic macros for MHD_config.h
data
void * data
Definition
microhttpd.h:4030
MHD_SHA512_256_finish
void MHD_SHA512_256_finish(struct Sha512_256Ctx *ctx, uint8_t digest[SHA512_256_DIGEST_SIZE])
Definition
sha512_256.c:539
MHD_SHA512_256_init
void MHD_SHA512_256_init(struct Sha512_256Ctx *ctx)
Definition
sha512_256.c:41
SHA512_256_BLOCK_SIZE_WORDS
#define SHA512_256_BLOCK_SIZE_WORDS
Definition
sha512_256.h:83
SHA512_256_HASH_SIZE_WORDS
#define SHA512_256_HASH_SIZE_WORDS
Definition
sha512_256.h:50
MHD_SHA512_256_update
void MHD_SHA512_256_update(struct Sha512_256Ctx *ctx, const uint8_t *data, size_t length)
Definition
sha512_256.c:460
SHA512_256_DIGEST_SIZE
#define SHA512_256_DIGEST_SIZE
Definition
sha512_256.h:62
Sha512_256Ctx
Definition
sha512_256.h:91
Sha512_256Ctx::count_bits_hi
uint64_t count_bits_hi
Definition
sha512_256.h:102
Sha512_256Ctx::count
uint64_t count
Definition
sha512_256.h:97
Sha512_256Ctx::H
uint64_t H[SHA512_256_HASH_SIZE_WORDS]
Definition
sha512_256.h:92
Sha512_256Ctx::buffer
uint64_t buffer[SHA512_256_BLOCK_SIZE_WORDS]
Definition
sha512_256.h:93
src
microhttpd
sha512_256.h
Generated by
1.17.0