aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/hash
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2019-12-08 12:03:52 -0500
committerJack Lloyd <[email protected]>2019-12-08 12:03:52 -0500
commitaecc77a0af80fdcebc71570a5e9a46c1b645aa7f (patch)
treee1a0a415c35bf98911e97123bfba209cab941d99 /src/lib/hash
parent70986f90a8ca503eb938d471305ae6cd2bcf504e (diff)
Minor optimization for Blake2b::final_result
Avoids some needless memsets
Diffstat (limited to 'src/lib/hash')
-rw-r--r--src/lib/hash/blake2/blake2b.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/hash/blake2/blake2b.cpp b/src/lib/hash/blake2/blake2b.cpp
index 9617fb4fb..0280d0c8b 100644
--- a/src/lib/hash/blake2/blake2b.cpp
+++ b/src/lib/hash/blake2/blake2b.cpp
@@ -51,6 +51,7 @@ void BLAKE2b::state_init()
m_H[0] ^= 0x01010000 ^ static_cast<uint8_t>(output_length());
m_T[0] = m_T[1] = 0;
m_F[0] = m_F[1] = 0;
+ m_bufpos = 0;
}
namespace {
@@ -177,7 +178,7 @@ void BLAKE2b::final_result(uint8_t output[])
m_F[0] = 0xFFFFFFFFFFFFFFFF;
compress(m_buffer.data(), 1, m_bufpos);
copy_out_vec_le(output, output_length(), m_H);
- clear();
+ state_init();
}
std::string BLAKE2b::name() const