From 75ffca1e7fffe439ee726b29de43e52a19866267 Mon Sep 17 00:00:00 2001 From: Ali Cheraghi Date: Fri, 24 Jan 2025 11:27:58 +0330 Subject: [PATCH] blake3: add reset() Signed-off-by: Ali Cheraghi --- include/nbl/core/hash/blake.h | 2 ++ src/nbl/core/hash/blake.cpp | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/include/nbl/core/hash/blake.h b/include/nbl/core/hash/blake.h index f56e0b12e7..82019327cb 100644 --- a/include/nbl/core/hash/blake.h +++ b/include/nbl/core/hash/blake.h @@ -41,6 +41,8 @@ class NBL_API2 blake3_hasher final blake3_hasher& update(const void* data, const size_t bytes); + void reset(); + template blake3_hasher& operator<<(const T& input) { update_impl::__call(*this, input); diff --git a/src/nbl/core/hash/blake.cpp b/src/nbl/core/hash/blake.cpp index 8bb961d9d0..043c28698d 100644 --- a/src/nbl/core/hash/blake.cpp +++ b/src/nbl/core/hash/blake.cpp @@ -14,6 +14,10 @@ blake3_hasher& blake3_hasher::update(const void* data, const size_t bytes) return *this; } +void blake3_hasher::reset() { + ::blake3_hasher_reset(&m_state); +} + blake3_hasher::operator blake3_hash_t() const { blake3_hash_t retval;