aboutsummaryrefslogtreecommitdiff
path: root/zencore/include
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-05-24 15:23:48 +0200
committerStefan Boberg <[email protected]>2021-05-24 15:23:48 +0200
commit8b5a464b86e8b9a101ceb05a299416f353c581fc (patch)
tree9f171f07e7748a5fce47c222c3aabf19d06021f2 /zencore/include
parentAdded functions to allow constructing memory views from a pointer range (diff)
downloadzen-8b5a464b86e8b9a101ceb05a299416f353c581fc.tar.xz
zen-8b5a464b86e8b9a101ceb05a299416f353c581fc.zip
Added BLAKE3Stream::Append accepting a MemoryView
Diffstat (limited to 'zencore/include')
-rw-r--r--zencore/include/zencore/blake3.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/zencore/include/zencore/blake3.h b/zencore/include/zencore/blake3.h
index bf4adb811..b31b710a7 100644
--- a/zencore/include/zencore/blake3.h
+++ b/zencore/include/zencore/blake3.h
@@ -6,6 +6,8 @@
#include <compare>
#include <cstring>
+#include <zencore/memory.h>
+
namespace zen {
class CompositeBuffer;
@@ -46,9 +48,10 @@ struct BLAKE3Stream
{
BLAKE3Stream();
- void Reset(); /// Begin streaming hash compute (not needed on freshly constructed instance)
- BLAKE3Stream& Append(const void* data, size_t byteCount); /// Append another chunk
- BLAKE3 GetHash(); /// Obtain final hash. If you wish to reuse the instance call reset()
+ void Reset(); // Begin streaming hash compute (not needed on freshly constructed instance)
+ BLAKE3Stream& Append(const void* data, size_t byteCount); // Append another chunk
+ BLAKE3Stream& Append(MemoryView DataView) { return Append(DataView.GetData(), DataView.GetSize()); } // Append another chunk
+ BLAKE3 GetHash(); // Obtain final hash. If you wish to reuse the instance call reset()
private:
alignas(16) uint8_t m_HashState[2048];