aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-05-28 12:46:44 -0400
committerJack Lloyd <[email protected]>2018-05-28 12:54:11 -0400
commit69fb023ffbaead5b136cc7a21af484a3c3b9691e (patch)
tree5397b3e0e66d91f0cafed7d00da8df5be1ae7ed2
parenteee4aa867fab83853155503d2a35c4018f6725a0 (diff)
Tiny optimization in MDx_HashFunction::final_result
Typically not a bottleneck but this shows up in XMSS profiling
-rw-r--r--src/lib/hash/mdx_hash/mdx_hash.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/lib/hash/mdx_hash/mdx_hash.cpp b/src/lib/hash/mdx_hash/mdx_hash.cpp
index 8c668874a..7d163dbfb 100644
--- a/src/lib/hash/mdx_hash/mdx_hash.cpp
+++ b/src/lib/hash/mdx_hash/mdx_hash.cpp
@@ -71,9 +71,8 @@ void MDx_HashFunction::add_data(const uint8_t input[], size_t length)
*/
void MDx_HashFunction::final_result(uint8_t output[])
{
+ clear_mem(&m_buffer[m_position], m_buffer.size() - m_position);
m_buffer[m_position] = (BIG_BIT_ENDIAN ? 0x80 : 0x01);
- for(size_t i = m_position+1; i != m_buffer.size(); ++i)
- m_buffer[i] = 0;
if(m_position >= m_buffer.size() - COUNT_SIZE)
{