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 4
4
#ifndef _NBL_CORE_HASH_BLAKE3_H_INCLUDED_
5
5
#define _NBL_CORE_HASH_BLAKE3_H_INCLUDED_
6
6
7
-
8
7
#include " blake3.h"
9
8
10
9
#include < span>
11
10
12
-
13
11
namespace nbl ::core
14
12
{
15
13
struct blake3_hash_t final
@@ -39,31 +37,14 @@ class blake3_hasher final
39
37
::blake3_hasher m_state;
40
38
41
39
public:
42
- inline blake3_hasher ()
43
- {
44
- ::blake3_hasher_init (&m_state);
45
- }
40
+ blake3_hasher ();
46
41
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);
52
43
53
44
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);
59
46
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 ;
67
48
};
68
49
69
50
// Useful specializations
Original file line number Diff line number Diff line change @@ -119,6 +119,7 @@ unset(NABLA_HEADERS_PUBLIC2 ${NBL_TMP_FULL_PATHS})
119
119
120
120
set (NBL_CORE_SOURCES
121
121
${NBL_ROOT_PATH} /src/nbl/core/IReferenceCounted.cpp
122
+ ${NBL_ROOT_PATH} /src/nbl/core/hash/blake.cpp
122
123
)
123
124
set (NBL_SYSTEM_SOURCES
124
125
${NBL_ROOT_PATH} /src/nbl/system/DefaultFuncPtrLoader.cpp
@@ -387,11 +388,6 @@ if(_NBL_BUILD_DPL_)
387
388
target_link_libraries (Nabla INTERFACE tbb tbbmalloc tbbmalloc_proxy )
388
389
endif ()
389
390
390
- # blake3
391
- target_link_libraries (Nabla PUBLIC
392
- blake3
393
- )
394
-
395
391
# boost
396
392
target_include_directories (Nabla PUBLIC "${BOOST_PREPROCESSOR_INCLUDE} " )
397
393
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