Module nixhash

Source

Modules§

algos 🔒
ca_hash 🔒

Enums§

CAHash
A Nix CAHash describes a content-addressed hash of a path.
CAHashMode
Representation for the supported hash modes.
Error
Errors related to NixHash construction.
HashAlgo
This are the hash algorithms supported by cppnix.
NixHash
NixHash represents hashes known by Nix.

Functions§

decode_digest 🔒
Decode a plain digest depending on the hash algo specified externally. hexlower, nixbase32 and base64 encodings are supported - the encoding is inferred from the input length.
from_algo_and_digest
Constructs a new NixHash by specifying HashAlgo and digest. It can fail if the passed digest length doesn’t match what’s expected for the passed algo.
from_nix_str
Parses a Nix hash string ($algo:$digest) to a NixHash.
from_sri_str
Parses a Nix SRI string to a NixHash. Contrary to the SRI spec, Nix doesn’t have an understanding of passing multiple hashes (with different algos) in SRI hashes. It instead simply cuts everything off after the expected length for the specified algo, and tries to parse the rest in permissive base64 (allowing missing padding).
from_str
Nix allows specifying hashes in various encodings, and magically just derives the encoding. This function parses strings to a NixHash.

Type Aliases§

NixHashResult
convenience Result type for all nixhash parsing Results.