Go to the source code of this file.
|
|
using | nix::detail::EvpMdCtxPtr = std::unique_ptr<EVP_MD_CTX, decltype(&EVP_MD_CTX_free)> |
| typedef std::pair< Hash, uint64_t > | nix::HashResult |
|
| enum class | HashType : char { MD5 = 42
, SHA1
, SHA256
, SHA512
} |
| enum class | Base : int { Base64
, Base32
, Base16
, SRI
} |
|
|
const int | nix::md5HashSize = 16 |
|
const int | nix::sha1HashSize = 20 |
|
const int | nix::sha256HashSize = 32 |
|
const int | nix::sha512HashSize = 64 |
◆ HashResult
Compute the hash of the given path. The hash is defined as (essentially) hashString(ht, dumpPath(path)).
◆ compressHash()
| Hash nix::compressHash |
( |
const Hash & | hash, |
|
|
unsigned int | newSize ) |
Compress a hash to the specified number of bytes by cyclically XORing bytes together.
◆ hashFile()
| Hash nix::hashFile |
( |
HashType | ht, |
|
|
const Path & | path ) |
Compute the hash of the given file.
◆ hashString()
| Hash nix::hashString |
( |
HashType | ht, |
|
|
std::string_view | s ) |
Compute the hash of the given string.
◆ newHashAllowEmpty()
| Hash nix::newHashAllowEmpty |
( |
std::string_view | hashStr, |
|
|
std::optional< HashType > | ht ) |
Helper that defaults empty hashes to the 0 hash.
◆ parseHashType()
| HashType nix::parseHashType |
( |
std::string_view | s | ) |
|
Parse a string representing a hash type.
◆ parseHashTypeOpt()
| std::optional< HashType > nix::parseHashTypeOpt |
( |
std::string_view | s | ) |
|
Will return nothing on parse error
◆ printHash16or32()
| std::string nix::printHash16or32 |
( |
const Hash & | hash | ) |
|
Print a hash in base-16 if it's MD5, or base-32 otherwise.
◆ printHashType()
| std::string_view nix::printHashType |
( |
HashType | ht | ) |
|