diff options
| author | Stefan Boberg <[email protected]> | 2021-05-24 15:23:48 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-05-24 15:23:48 +0200 |
| commit | 8b5a464b86e8b9a101ceb05a299416f353c581fc (patch) | |
| tree | 9f171f07e7748a5fce47c222c3aabf19d06021f2 /zencore/include | |
| parent | Added functions to allow constructing memory views from a pointer range (diff) | |
| download | zen-8b5a464b86e8b9a101ceb05a299416f353c581fc.tar.xz zen-8b5a464b86e8b9a101ceb05a299416f353c581fc.zip | |
Added BLAKE3Stream::Append accepting a MemoryView
Diffstat (limited to 'zencore/include')
| -rw-r--r-- | zencore/include/zencore/blake3.h | 9 |
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]; |