ProtoCore v0.0.1
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 <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Macros

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

Functions

void pc_sha1 (const uint8_t *data, size_t len, uint8_t digest[PC_SHA1_DIGEST_LEN])
 Compute a SHA-1 digest over an arbitrary byte buffer.
 

Detailed Description

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

The shared SHA-1 primitive. On Arduino (ESP32) delegates to mbedtls_sha1() (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.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file sha1.h.

Macro Definition Documentation

◆ PC_SHA1_DIGEST_LEN

#define PC_SHA1_DIGEST_LEN   20

SHA-1 digest length in bytes.

Definition at line 23 of file sha1.h.

Function Documentation

◆ pc_sha1()

void pc_sha1 ( const uint8_t *  data,
size_t  len,
uint8_t  digest[PC_SHA1_DIGEST_LEN] 
)

Compute a SHA-1 digest over an arbitrary byte buffer.

Parameters
dataInput bytes.
lenNumber of input bytes.
digestOutput buffer; must be at least PC_SHA1_DIGEST_LEN bytes.

Definition at line 26 of file sha1.cpp.