![]() |
Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
|
#include "nix/util/configuration.hh"#include "nix/util/types.hh"#include "nix/util/serialise.hh"#include "nix/util/file-system.hh"#include "nix/util/json-impls.hh"Go to the source code of this file.
Classes | |
| struct | nix::Hash |
| struct | nix::HashResult |
| struct | nix::AbstractHashSink |
| class | nix::HashSink |
| struct | std::hash< nix::Hash > |
Enumerations | |
| enum struct | HashAlgorithm : char { MD5 = 42 , SHA1 , SHA256 , SHA512 , BLAKE3 } |
| enum struct | nix::HashFormat : int { Base64 , Nix32 , Base16 , SRI } |
| Enumeration representing the hash formats. More... | |
Functions | |
| nix::MakeError (BadHash, Error) | |
| constexpr size_t | nix::regularHashSize (HashAlgorithm type) |
| Hash | nix::newHashAllowEmpty (std::string_view hashStr, std::optional< HashAlgorithm > ha) |
| Hash | nix::hashString (HashAlgorithm ha, std::string_view s, const ExperimentalFeatureSettings &xpSettings) |
| Hash | nix::hashFile (HashAlgorithm ha, const std::filesystem::path &path) |
| Hash | nix::compressHash (const Hash &hash, unsigned int newSize) |
| HashFormat | nix::parseHashFormat (std::string_view hashFormatName) |
| std::optional< HashFormat > | nix::parseHashFormatOpt (std::string_view hashFormatName) |
| std::string_view | nix::printHashFormat (HashFormat HashFormat) |
| HashAlgorithm | nix::parseHashAlgo (std::string_view s, const ExperimentalFeatureSettings &xpSettings) |
| std::optional< HashAlgorithm > | nix::parseHashAlgoOpt (std::string_view s, const ExperimentalFeatureSettings &xpSettings) |
| std::string_view | nix::printHashAlgo (HashAlgorithm ha) |
| std::size_t | nix::hash_value (const Hash &hash) |
|
strong |
Enumeration representing the hash formats.
| Enumerator | |
|---|---|
| Base64 | Base 64 encoding.
|
| Nix32 | Nix-specific base-32 encoding.
|
| Base16 | Lowercase hexadecimal encoding.
|
| SRI | "<hash algo>:<Base 64 hash>", format of the SRI integrity attribute.
|
| Hash nix::compressHash | ( | const Hash & | hash, |
| unsigned int | newSize ) |
Compress a hash to the specified number of bytes by cyclically XORing bytes together.
| Hash nix::hashFile | ( | HashAlgorithm | ha, |
| const std::filesystem::path & | path ) |
Compute the hash of the given file, hashing its contents directly.
(Metadata, such as the executable permission bit, is ignored.)
| Hash nix::hashString | ( | HashAlgorithm | ha, |
| std::string_view | s, | ||
| const ExperimentalFeatureSettings & | xpSettings = experimentalFeatureSettings ) |
Compute the hash of the given string.
| Hash nix::newHashAllowEmpty | ( | std::string_view | hashStr, |
| std::optional< HashAlgorithm > | ha ) |
Helper that defaults empty hashes to the 0 hash.
| HashAlgorithm nix::parseHashAlgo | ( | std::string_view | s, |
| const ExperimentalFeatureSettings & | xpSettings = experimentalFeatureSettings ) |
Parse a string representing a hash algorithm.
| std::optional< HashAlgorithm > nix::parseHashAlgoOpt | ( | std::string_view | s, |
| const ExperimentalFeatureSettings & | xpSettings = experimentalFeatureSettings ) |
Will return nothing on parse error
| HashFormat nix::parseHashFormat | ( | std::string_view | hashFormatName | ) |
Parse a string representing a hash format.
| std::optional< HashFormat > nix::parseHashFormatOpt | ( | std::string_view | hashFormatName | ) |
std::optional version of parseHashFormat that doesn't throw error.
| std::string_view nix::printHashAlgo | ( | HashAlgorithm | ha | ) |
And the reverse.
| std::string_view nix::printHashFormat | ( | HashFormat | hashFormat | ) |
The reverse of parseHashFormat.
|
inlineconstexpr |