about summary refs log tree commit diff
path: root/third_party/nix/src/libutil/hash.hh
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/src/libutil/hash.hh')
-rw-r--r--third_party/nix/src/libutil/hash.hh10
1 files changed, 10 insertions, 0 deletions
diff --git a/third_party/nix/src/libutil/hash.hh b/third_party/nix/src/libutil/hash.hh
index 58f808896fe2..0b7b11edd072 100644
--- a/third_party/nix/src/libutil/hash.hh
+++ b/third_party/nix/src/libutil/hash.hh
@@ -1,5 +1,7 @@
 #pragma once
 
+#include <absl/status/statusor.h>
+
 #include "libutil/serialise.hh"
 #include "libutil/types.hh"
 
@@ -36,6 +38,10 @@ struct Hash {
      string. */
   Hash(const std::string& s, HashType type = htUnknown);
 
+  /* Status-returning version of above constructor */
+  static absl::StatusOr<Hash> deserialize(const std::string& s,
+                                          HashType type = htUnknown);
+
   void init();
 
   /* Check whether a hash is set. */
@@ -64,6 +70,10 @@ struct Hash {
      (e.g. "sha256:"). */
   std::string to_string(Base base = Base32, bool includeType = true) const;
 
+  /* Returns whether the passed string contains entirely valid base16
+     characters. */
+  static bool IsValidBase16(absl::string_view s);
+
   /* Returns whether the passed string contains entirely valid base32
      characters. */
   static bool IsValidBase32(absl::string_view s);