![]() |
Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
|
DEMO |
A single link in the cryptographic hash chain. More...
#include <audit_chain.hpp>
Public Member Functions | |
| void | compute_entry_hash () |
| Derive entry_hash from the other fields. | |
| bool | verify () const |
| Check that entry_hash is consistent with the other fields. | |
| std::vector< uint8_t > | serialize () const |
| Serialize this entry as 112 little-endian bytes. | |
Static Public Member Functions | |
| static expected< HashChainEntry > | deserialize (const uint8_t *data, size_t size) |
| Reconstruct a HashChainEntry from 112 bytes. | |
Public Attributes | |
| int64_t | sequence_number = 0 |
| 0-indexed position in the chain, monotonically increasing. | |
| int64_t | timestamp_ns = 0 |
| Nanoseconds since Unix epoch when this entry was created. | |
| std::array< uint8_t, 32 > | prev_hash {} |
| SHA-256 hash of the previous entry (all zeros for the first entry, or a user-supplied continuation hash when spanning files). | |
| std::array< uint8_t, 32 > | data_hash {} |
| SHA-256 hash of the record/row data that this entry covers. | |
| std::array< uint8_t, 32 > | entry_hash {} |
| SHA-256 commitment over (sequence_number, timestamp_ns, prev_hash, data_hash). | |
A single link in the cryptographic hash chain.
Each entry commits to:
The entry_hash binds all of these fields together:
Definition at line 274 of file audit_chain.hpp.
|
inline |
Derive entry_hash from the other fields.
Must be called after setting sequence_number, timestamp_ns, prev_hash, and data_hash. The AuditChainWriter calls this automatically; manual callers must invoke it explicitly.
Definition at line 300 of file audit_chain.hpp.
|
inlinestatic |
Reconstruct a HashChainEntry from 112 bytes.
| data | Pointer to the serialized binary data. |
| size | Number of bytes available at data. |
Definition at line 366 of file audit_chain.hpp.
|
inline |
Serialize this entry as 112 little-endian bytes.
Layout:
Definition at line 348 of file audit_chain.hpp.
|
inline |
Check that entry_hash is consistent with the other fields.
Recomputes the expected entry_hash and compares it to the stored value. Uses constant-time comparison to prevent timing side channels.
Definition at line 318 of file audit_chain.hpp.
| std::array<uint8_t, 32> signet::forge::HashChainEntry::data_hash {} |
SHA-256 hash of the record/row data that this entry covers.
Definition at line 286 of file audit_chain.hpp.
| std::array<uint8_t, 32> signet::forge::HashChainEntry::entry_hash {} |
SHA-256 commitment over (sequence_number, timestamp_ns, prev_hash, data_hash).
This is the cryptographic binding that makes the chain tamper-evident.
Definition at line 291 of file audit_chain.hpp.
| std::array<uint8_t, 32> signet::forge::HashChainEntry::prev_hash {} |
SHA-256 hash of the previous entry (all zeros for the first entry, or a user-supplied continuation hash when spanning files).
Definition at line 283 of file audit_chain.hpp.
| int64_t signet::forge::HashChainEntry::sequence_number = 0 |
0-indexed position in the chain, monotonically increasing.
Definition at line 276 of file audit_chain.hpp.
| int64_t signet::forge::HashChainEntry::timestamp_ns = 0 |
Nanoseconds since Unix epoch when this entry was created.
Definition at line 279 of file audit_chain.hpp.