crypto: refactor ChaCha20 classes to use Span<std::byte> interface

This commit is contained in:
Pieter Wuille
2023-07-18 10:11:49 -04:00
parent 6ce5e8f475
commit 3da636e08b
10 changed files with 200 additions and 178 deletions

View File

@@ -175,9 +175,9 @@ public:
uint64_t rand64() noexcept
{
if (requires_seed) RandomSeed();
unsigned char buf[8];
rng.Keystream(buf, 8);
return ReadLE64(buf);
std::array<std::byte, 8> buf;
rng.Keystream(buf);
return ReadLE64(UCharCast(buf.data()));
}
/** Generate a random (bits)-bit integer. */