File tree Expand file tree Collapse file tree 2 files changed +16
-17
lines changed Expand file tree Collapse file tree 2 files changed +16
-17
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ struct blake3_hash_t final
19
19
uint8_t data[BLAKE3_OUT_LEN];
20
20
};
21
21
22
- class blake3_hasher final
22
+ class NBL_API2 blake3_hasher final
23
23
{
24
24
template <typename T, typename Dummy=void >
25
25
struct update_impl
@@ -42,7 +42,10 @@ class blake3_hasher final
42
42
blake3_hasher& update (const void * data, const size_t bytes);
43
43
44
44
template <typename T>
45
- blake3_hasher& operator <<(const T& input);
45
+ blake3_hasher& operator <<(const T& input) {
46
+ update_impl<T>::__call (*this , input);
47
+ return *this ;
48
+ }
46
49
47
50
explicit operator blake3_hash_t () const ;
48
51
};
Original file line number Diff line number Diff line change 1
1
#include " nbl/core/hash/blake.h"
2
2
3
- using namespace nbl ;
4
-
5
- core::blake3_hasher::blake3_hasher ()
3
+ namespace nbl ::core
6
4
{
7
- ::blake3_hasher_init (&m_state);
8
- }
9
5
10
- core:: blake3_hasher& core ::blake3_hasher::update ( const void * data, const size_t bytes )
6
+ blake3_hasher::blake3_hasher ( )
11
7
{
12
- ::blake3_hasher_update (&m_state,data,bytes);
13
- return *this ;
8
+ ::blake3_hasher_init (&m_state);
14
9
}
15
10
16
- template <typename T>
17
- core::blake3_hasher& core::blake3_hasher::operator <<(const T& input)
11
+ blake3_hasher& blake3_hasher::update (const void * data, const size_t bytes)
18
12
{
19
- update_impl<T>:: __call (* this ,input );
13
+ ::blake3_hasher_update (&m_state, data, bytes );
20
14
return *this ;
21
15
}
22
16
23
- core:: blake3_hasher::operator core:: blake3_hash_t () const
17
+ blake3_hasher::operator blake3_hash_t () const
24
18
{
25
- core:: blake3_hash_t retval;
19
+ blake3_hash_t retval;
26
20
// the blake3 docs say that the hasher can be finalized multiple times
27
- ::blake3_hasher_finalize (&m_state,retval.data,sizeof (retval));
21
+ ::blake3_hasher_finalize (&m_state, retval.data, sizeof (retval));
28
22
return retval;
29
- }
23
+ }
24
+
25
+ }
You can’t perform that action at this time.
0 commit comments