std1.0.0-beta-7 SafeC docs

Module crypto::sha1

#include <std/crypto/sha1.h> source

SHA-1 Hash (FIPS 180-4) Freestanding-safe. No dynamic allocation.

SHA-1 is cryptographically broken (practical collision attacks exist since 2017) — don't use it for anything security-sensitive. It's provided because some still-current wire protocols require it specifically, not as a general-purpose hash recommendation: notably the WebSocket handshake (RFC 6455 section 1.3's Sec-WebSocket-Accept computation is defined in terms of SHA-1, with no alternative). Prefer std::sha256/std::sha512 (see sha256.h/sha512.h) for anything else.

Structs

Sha1Ctx

Functions

sha1Convenience: hash len bytes and write the 20-byte digest.

Macros

SHA1_DIGEST_SIZEbytes
SHA1_BLOCK_SIZEbytes