diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-06-17 10:26:52 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-06-17 10:26:52 +0200 |
commit | 1524752c17ee8753467f068c23fbe1d994aa8f75 (patch) | |
tree | c802ca482e2461765dcbdcef5cc6fa38c9d1c42b /src/libutil/hash.hh | |
parent | 7db879e65e83b1c65206b490d36a69e97c5a877a (diff) | |
parent | 29542865cee37ab22efe1bd142900b69f6c59f0d (diff) |
Merge remote-tracking branch 'origin/master' into flakes
Diffstat (limited to 'src/libutil/hash.hh')
-rw-r--r-- | src/libutil/hash.hh | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libutil/hash.hh b/src/libutil/hash.hh index e1a16ba22..c5724a321 100644 --- a/src/libutil/hash.hh +++ b/src/libutil/hash.hh @@ -44,7 +44,7 @@ struct Hash Subresource Integrity hash expression). If the 'type' argument is htUnknown, then the hash type must be specified in the string. */ - Hash(const std::string & s, HashType type = htUnknown); + Hash(std::string_view s, HashType type = htUnknown); void init(); @@ -81,7 +81,7 @@ struct Hash /* Return a string representation of the hash, in base-16, base-32 or base-64. By default, this is prefixed by the hash type (e.g. "sha256:"). */ - std::string to_string(Base base = Base32, bool includeType = true) const; + std::string to_string(Base base, bool includeType) const; std::string gitRev() const { @@ -96,6 +96,8 @@ struct Hash } }; +/* Helper that defaults empty hashes to the 0 hash. */ +Hash newHashAllowEmpty(std::string hashStr, HashType ht); /* Print a hash in base-16 if it's MD5, or base-32 otherwise. */ string printHash16or32(const Hash & hash); |