wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
sha512.h
1
#ifndef HASH_SHA512_H
2
#define HASH_SHA512_H
3
4
#include "
common/platform/sys/syscall.h
"
5
6
/* FIPS 180-4 SHA-512. Produces a 64-byte digest. */
7
8
#define SHA512_DIGEST 64
9
#define SHA512_BLOCK 128
10
13
typedef
struct
{
14
u64
h
[8];
15
u64
total
;
16
u8
buf
[SHA512_BLOCK];
17
usz
buf_len
;
18
}
sha512_ctx
;
19
20
void
sha512_init(
sha512_ctx
* s);
21
void
sha512_update(
sha512_ctx
* s,
const
u8
* data,
usz
len);
22
void
sha512_final(
sha512_ctx
* s,
u8
out[SHA512_DIGEST]);
23
24
/* One-shot convenience: digest of data[0..len). */
25
void
sha512(
const
u8
* data,
usz
len,
u8
out[SHA512_DIGEST]);
26
27
#endif
sha512_ctx
Incremental SHA-512 state: running hash, total bytes absorbed, and the partial-block buffer.
Definition
sha512.h:13
sha512_ctx::buf
u8 buf[SHA512_BLOCK]
partial-block buffer
Definition
sha512.h:16
sha512_ctx::buf_len
usz buf_len
bytes pending in buf
Definition
sha512.h:17
sha512_ctx::h
u64 h[8]
running hash state
Definition
sha512.h:14
sha512_ctx::total
u64 total
total bytes absorbed (low 64 bits suffice here)
Definition
sha512.h:15
syscall.h
Linux direct syscalls.
usz
u64 usz
unsigned size (size_t equivalent)
Definition
types.h:20
u8
unsigned char u8
unsigned 8-bit integer / byte
Definition
types.h:18
u64
unsigned long u64
unsigned 64-bit integer
Definition
types.h:13
crypto
symmetric
hash
hash
sha512.h
Generated by
1.16.1