Struct ContentHash
A 128-bit xxHash128 content hash. Persisted big-endian as BLOB(16) (spec 9.1).
public readonly record struct ContentHash : IEquatable<ContentHash>
- Implements
- Inherited Members
Constructors
- ContentHash(UInt128)
A 128-bit xxHash128 content hash. Persisted big-endian as
BLOB(16)(spec 9.1).
Fields
- AlgorithmId
The value stored in
qedge_ingest_meta.hash_algorithm.
- BlobLength
The blob width, in bytes. Sixteen, always.
Properties
- Value
The raw 128-bit digest.
- Zero
The all-zero hash. Means "no hash recorded", never "hash of nothing".
Methods
- Combine(ReadOnlySpan<ContentHash>)
Order-sensitive combination over the 0x1F-separated big-endian renderings of
parts. This is spec 9.3's key derivation.
- FromBlob(ReadOnlySpan<byte>)
Reads the persisted form. Any length but sixteen is 6204.
- OfBytes(ReadOnlySpan<byte>)
Hashes raw bytes.
- OfStreamAsync(Stream, long, int, CancellationToken)
Spec 9.1's counted read. Streams
streaminbufferSizeblocks, carries a running byte count, and returns null the moment the count exceedsmaxBytes.A null result is NOT a hash of a truncated read and must never be persisted as one: storing the hash of a partial read would make a later shrink of the file look unchanged. At most
maxBytes + bufferSizebytes are ever read and nothing is buffered.
- OfText(string)
Hashes
textas UTF-8 with no BOM.
- ToBlob()
The persisted form: sixteen bytes, big-endian.
- ToHex()
Thirty-two lowercase hex characters.
- ToString()
Returns the fully qualified type name of this instance.
- TryParseHex(ReadOnlySpan<char>, out ContentHash)
Parses ToHex()'s output. Case-insensitive.