aboutsummaryrefslogtreecommitdiff
path: root/zencore/iohash.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'zencore/iohash.cpp')
-rw-r--r--zencore/iohash.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/zencore/iohash.cpp b/zencore/iohash.cpp
index afe2e54ba..9b095ccdb 100644
--- a/zencore/iohash.cpp
+++ b/zencore/iohash.cpp
@@ -3,6 +3,7 @@
#include <zencore/iohash.h>
#include <zencore/blake3.h>
+#include <zencore/compositebuffer.h>
#include <zencore/string.h>
#include <doctest/doctest.h>
@@ -24,6 +25,19 @@ IoHash::HashMemory(const void* data, size_t byteCount)
}
IoHash
+IoHash::HashMemory(const CompositeBuffer& Buffer)
+{
+ IoHashStream Hasher;
+
+ for (const SharedBuffer& Segment : Buffer.GetSegments())
+ {
+ Hasher.Append(Segment.GetData(), Segment.GetSize());
+ }
+
+ return Hasher.GetHash();
+}
+
+IoHash
IoHash::FromHexString(const char* string)
{
return FromHexString({string, sizeof(IoHash::Hash) * 2});