GNU libmicrohttpd  0.9.72
sha256.h
Go to the documentation of this file.
1 /*
2  This file is part of libmicrohttpd
3  Copyright (C) 2019 Karlson2k (Evgeny Grin)
4 
5  This library 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 
26 #ifndef MHD_SHA256_H
27 #define MHD_SHA256_H 1
28 
29 #include "mhd_options.h"
30 #include <stdint.h>
31 #include <stddef.h>
32 
36 #define _SHA256_DIGEST_LENGTH 8
37 
41 #define SHA256_DIGEST_SIZE (_SHA256_DIGEST_LENGTH * 4)
42 
46 #define SHA256_DIGEST_STRING_SIZE ((SHA256_DIGEST_SIZE) * 2 + 1)
47 
51 #define SHA256_BLOCK_SIZE 64
52 
53 
54 struct sha256_ctx
55 {
57  uint64_t count;
59 };
60 
66 void
67 MHD_SHA256_init (void *ctx_);
68 
69 
77 void
78 MHD_SHA256_update (void *ctx_,
79  const uint8_t *data,
80  size_t length);
81 
82 
89 void
90 sha256_finish (void *ctx_,
91  uint8_t digest[SHA256_DIGEST_SIZE]);
92 
93 #endif /* MHD_SHA256_H */
additional automatic macros for MHD_config.h
void * data
Definition: microhttpd.h:3053
#define _SHA256_DIGEST_LENGTH
Definition: sha256.h:36
#define SHA256_DIGEST_SIZE
Definition: sha256.h:41
#define SHA256_BLOCK_SIZE
Definition: sha256.h:51
void sha256_finish(void *ctx_, uint8_t digest[SHA256_DIGEST_SIZE])
Definition: sha256.c:321
void MHD_SHA256_init(void *ctx_)
Definition: sha256.c:45
void MHD_SHA256_update(void *ctx_, const uint8_t *data, size_t length)
Definition: sha256.c:259
uint8_t buffer[SHA256_BLOCK_SIZE]
Definition: sha256.h:58
uint32_t H[_SHA256_DIGEST_LENGTH]
Definition: sha256.h:56
uint64_t count
Definition: sha256.h:57