Merge pull request #960 from notlesh/aligned_buffer_iszero_optimization

Optimize AlignedBuffer:::IsZero()
pull/963/head
Jeff 5 years ago committed by GitHub
commit 0b9eb13f5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -20,6 +20,9 @@ extern "C"
{
extern void
randombytes(unsigned char* const ptr, unsigned long long sz);
extern int
sodium_is_zero(const unsigned char *n, const size_t nlen);
}
namespace llarp
{
@ -188,9 +191,7 @@ namespace llarp
bool
IsZero() const
{
auto notZero = [](byte_t b) { return b != 0; };
return std::find_if(begin(), end(), notZero) == end();
return sodium_is_zero(data(), size());
}
void

Loading…
Cancel
Save