Skip to content

Commit

Permalink
hash_t::random() clear random bytes buffer after using it
Browse files Browse the repository at this point in the history
  • Loading branch information
madMAx43v3r committed Nov 15, 2023
1 parent ca4b912 commit f55c0a2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/hash_t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ hash_t hash_t::random()
{
std::vector<uint8_t> seed(4096);
::randombytes_buf(seed.data(), seed.size());
return hash_t(seed);

const hash_t out(seed);
::memset(seed.data(), 0, seed.size()); // clear memory
return out;
}


Expand Down

0 comments on commit f55c0a2

Please sign in to comment.