wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
sha256.h File Reference

FIPS 180-4 SHA-256. More...

Go to the source code of this file.

Data Structures

struct  quic_sha256_ctx
 Streaming SHA-256 state. More...

Macros

#define QUIC_SHA256_DIGEST   32
 digest length in bytes
#define QUIC_SHA256_BLOCK   64
 internal block length in bytes

Functions

void quic_sha256_init (quic_sha256_ctx *s)
 Reset s to the initial SHA-256 state.
void quic_sha256_update (quic_sha256_ctx *s, const u8 *data, usz len)
 Absorb data[0..len) into the running hash.
void quic_sha256_final (quic_sha256_ctx *s, u8 out[QUIC_SHA256_DIGEST])
 Finish the hash and write the digest.
void quic_sha256 (const u8 *data, usz len, u8 out[QUIC_SHA256_DIGEST])
 One-shot convenience: digest of data[0..len).

Detailed Description

FIPS 180-4 SHA-256.

Produces a 32-byte digest.

Function Documentation

◆ quic_sha256()

void quic_sha256 ( const u8 * data,
usz len,
u8 out[QUIC_SHA256_DIGEST] )

One-shot convenience: digest of data[0..len).

Parameters
databytes to hash
lennumber of bytes at data
outreceives the 32-byte digest

◆ quic_sha256_final()

void quic_sha256_final ( quic_sha256_ctx * s,
u8 out[QUIC_SHA256_DIGEST] )

Finish the hash and write the digest.

Parameters
scontext to finalize (its state is consumed)
outreceives the 32-byte digest

◆ quic_sha256_init()

void quic_sha256_init ( quic_sha256_ctx * s)

Reset s to the initial SHA-256 state.

Parameters
scontext to initialize

◆ quic_sha256_update()

void quic_sha256_update ( quic_sha256_ctx * s,
const u8 * data,
usz len )

Absorb data[0..len) into the running hash.

Parameters
scontext previously initialized
databytes to absorb
lennumber of bytes at data