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
1919 uint8_t data[BLAKE3_OUT_LEN];
2020};
2121
22- class blake3_hasher final
22+ class NBL_API2 blake3_hasher final
2323{
2424 template <typename T, typename Dummy=void >
2525 struct update_impl
@@ -42,7 +42,10 @@ class blake3_hasher final
4242 blake3_hasher& update (const void * data, const size_t bytes);
4343
4444 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+ }
4649
4750 explicit operator blake3_hash_t () const ;
4851};
Original file line number Diff line number Diff line change 11#include " nbl/core/hash/blake.h"
22
3- using namespace nbl ;
4-
5- core::blake3_hasher::blake3_hasher ()
3+ namespace nbl ::core
64{
7- ::blake3_hasher_init (&m_state);
8- }
95
10- core:: blake3_hasher& core ::blake3_hasher::update ( const void * data, const size_t bytes )
6+ blake3_hasher::blake3_hasher ( )
117{
12- ::blake3_hasher_update (&m_state,data,bytes);
13- return *this ;
8+ ::blake3_hasher_init (&m_state);
149}
1510
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)
1812{
19- update_impl<T>:: __call (* this ,input );
13+ ::blake3_hasher_update (&m_state, data, bytes );
2014 return *this ;
2115}
2216
23- core:: blake3_hasher::operator core:: blake3_hash_t () const
17+ blake3_hasher::operator blake3_hash_t () const
2418{
25- core:: blake3_hash_t retval;
19+ blake3_hash_t retval;
2620 // 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));
2822 return retval;
29- }
23+ }
24+
25+ }
You can’t perform that action at this time.
0 commit comments