summaryrefslogtreecommitdiff
path: root/include/erebos/storage.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/erebos/storage.h')
-rw-r--r--include/erebos/storage.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/erebos/storage.h b/include/erebos/storage.h
index 29eaa8f..4f67a4b 100644
--- a/include/erebos/storage.h
+++ b/include/erebos/storage.h
@@ -123,6 +123,9 @@ public:
explicit operator std::string() const;
bool isZero() const;
+ static Digest of(const std::vector<uint8_t> & content);
+ template<class S> static Digest of(const ObjectT<S> &);
+
const std::array<uint8_t, size> & arr() const { return value; }
bool operator==(const Digest & other) const { return value == other.value; }
@@ -136,6 +139,12 @@ private:
std::array<uint8_t, size> value;
};
+template<class S>
+Digest Digest::of(const ObjectT<S> & obj)
+{
+ return Digest::of(obj.encode());
+}
+
class PartialRef
{
public: