ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
sha1.h File Reference

SHA-1 (FIPS 180-4) - one-shot digest. More...

#include "protocore_config.h"

Go to the source code of this file.

Classes

struct  Sha1Ns
 Dispatch table. Addressed by offset, so the layout is asserted below. More...
 

Macros

#define PROTOCORE_SHA1_DIGEST_LEN   20
 SHA-1 digest length in bytes.
 

Functions

 PROTOCORE_NS_LAYOUT (Sha1Ns, hash)
 
proto_bool protocore_sha1_hash (uint8_t *work, const uint8_t *data, size_t len, uint8_t *out)
 Digest the whole message in one call.
 

Variables

PROTOCORE_NS Sha1Ns Sha1 PROTOCORE_UNUSED = {.hash = protocore_sha1_hash}
 Module namespace.
 

Detailed Description

SHA-1 (FIPS 180-4) - one-shot digest.

The shared SHA-1 primitive. On Arduino (ESP32) delegates to the hardware SHA accelerator; on native builds a portable software implementation is used. Used for the WebSocket opening handshake (RFC 6455 ยง4.2.2) and other legacy digest needs. Output is always 20 bytes.

work is PROTOCORE_SHA1_BORROW secure bytes the CALLER took, at an address it knows. It is not held past the call, so nothing here aliases it. The caller releases it, and the pool wipes on release; this module neither takes it, holds it, releases it, nor wipes it.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file sha1.h.

Macro Definition Documentation

◆ PROTOCORE_SHA1_DIGEST_LEN

#define PROTOCORE_SHA1_DIGEST_LEN   20

SHA-1 digest length in bytes.

Definition at line 28 of file sha1.h.

Function Documentation

◆ PROTOCORE_NS_LAYOUT()

PROTOCORE_NS_LAYOUT ( Sha1Ns  ,
hash   
)

◆ protocore_sha1_hash()

proto_bool protocore_sha1_hash ( uint8_t *  work,
const uint8_t *  data,
size_t  len,
uint8_t *  out 
)

Digest the whole message in one call.

Parameters
workPROTOCORE_SHA1_BORROW bytes the caller took. Not held past the call.
datathe bytes
lenhow many
outPROTOCORE_SHA1_DIGEST_LEN bytes
Returns
PROTO_TRUE on success.

Variable Documentation

◆ PROTOCORE_UNUSED

PROTOCORE_NS Sha1Ns Sha1 PROTOCORE_UNUSED = {.hash = protocore_sha1_hash}

Module namespace.

Definition at line 48 of file sha1.h.