File tree Expand file tree Collapse file tree 3 files changed +34
-28
lines changed
Expand file tree Collapse file tree 3 files changed +34
-28
lines changed Original file line number Diff line number Diff line change 44#ifndef _NBL_CORE_HASH_BLAKE3_H_INCLUDED_
55#define _NBL_CORE_HASH_BLAKE3_H_INCLUDED_
66
7-
87#include " blake3.h"
98
109#include < span>
1110
12-
1311namespace nbl ::core
1412{
1513struct blake3_hash_t final
@@ -39,31 +37,14 @@ class blake3_hasher final
3937 ::blake3_hasher m_state;
4038
4139 public:
42- inline blake3_hasher ()
43- {
44- ::blake3_hasher_init (&m_state);
45- }
40+ blake3_hasher ();
4641
47- inline blake3_hasher& update (const void * data, const size_t bytes)
48- {
49- ::blake3_hasher_update (&m_state,data,bytes);
50- return *this ;
51- }
42+ blake3_hasher& update (const void * data, const size_t bytes);
5243
5344 template <typename T>
54- blake3_hasher& operator <<(const T& input)
55- {
56- update_impl<T>::__call (*this ,input);
57- return *this ;
58- }
45+ blake3_hasher& operator <<(const T& input);
5946
60- explicit inline operator blake3_hash_t () const
61- {
62- blake3_hash_t retval;
63- // the blake3 docs say that the hasher can be finalized multiple times
64- ::blake3_hasher_finalize (&m_state,retval.data,sizeof (retval));
65- return retval;
66- }
47+ explicit operator blake3_hash_t () const ;
6748};
6849
6950// Useful specializations
Original file line number Diff line number Diff line change @@ -119,6 +119,7 @@ unset(NABLA_HEADERS_PUBLIC2 ${NBL_TMP_FULL_PATHS})
119119
120120set (NBL_CORE_SOURCES
121121 ${NBL_ROOT_PATH} /src/nbl/core/IReferenceCounted.cpp
122+ ${NBL_ROOT_PATH} /src/nbl/core/hash/blake.cpp
122123)
123124set (NBL_SYSTEM_SOURCES
124125 ${NBL_ROOT_PATH} /src/nbl/system /DefaultFuncPtrLoader.cpp
@@ -387,11 +388,6 @@ if(_NBL_BUILD_DPL_)
387388 target_link_libraries (Nabla INTERFACE tbb tbbmalloc tbbmalloc_proxy)
388389endif ()
389390
390- # blake3
391- target_link_libraries (Nabla PUBLIC
392- blake3
393- )
394-
395391# boost
396392target_include_directories (Nabla PUBLIC "${BOOST_PREPROCESSOR_INCLUDE} " )
397393
Original file line number Diff line number Diff line change 1+ #include " nbl/core/hash/blake.h"
2+
3+ using namespace nbl ;
4+
5+ core::blake3_hasher::blake3_hasher ()
6+ {
7+ ::blake3_hasher_init (&m_state);
8+ }
9+
10+ core::blake3_hasher& core::blake3_hasher::update (const void * data, const size_t bytes)
11+ {
12+ ::blake3_hasher_update (&m_state,data,bytes);
13+ return *this ;
14+ }
15+
16+ template <typename T>
17+ core::blake3_hasher& core::blake3_hasher::operator <<(const T& input)
18+ {
19+ update_impl<T>::__call (*this ,input);
20+ return *this ;
21+ }
22+
23+ core::blake3_hasher::operator core::blake3_hash_t () const
24+ {
25+ core::blake3_hash_t retval;
26+ // the blake3 docs say that the hasher can be finalized multiple times
27+ ::blake3_hasher_finalize (&m_state,retval.data,sizeof (retval));
28+ return retval;
29+ }
You can’t perform that action at this time.
0 commit comments