Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
Loading...
Searching...
No Matches
sha256.hpp File Reference

Self-contained SHA-256 (FIPS 180-4) and the Digest256 value type. More...

#include <array>
#include <cstdint>
#include <string>
#include <string_view>
Include dependency graph for sha256.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  bertini::detail::Digest256
 A 256-bit content digest – the output of Sha256, used as a persistent identity key. More...

Namespaces

namespace  bertini
namespace  bertini::detail

Functions

Digest256 bertini::detail::Sha256 (std::string_view data)
 SHA-256 (FIPS 180-4) of a byte string.

Detailed Description

Self-contained SHA-256 (FIPS 180-4) and the Digest256 value type.

This exists to give Systems a PERSISTENT content identity (ADR-0042): a digest that is bit-identical across runs, compilers, standard libraries, and Boost versions. That rules out std::hash (implementation-defined), typeid().hash_code() (per-process), and boost::uuids::detail::sha1 (detail:: namespace = no stability contract). So we carry our own ~150-line clean-room FIPS 180-4 implementation, pinned by FIPS test vectors in sha256_test.cpp. It hashes canonical-encoding text (small, cold-path) – throughput is irrelevant; stability is everything.