From 69fb023ffbaead5b136cc7a21af484a3c3b9691e Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Mon, 28 May 2018 12:46:44 -0400 Subject: Tiny optimization in MDx_HashFunction::final_result Typically not a bottleneck but this shows up in XMSS profiling --- src/lib/hash/mdx_hash/mdx_hash.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/lib/hash/mdx_hash/mdx_hash.cpp') 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) { -- cgit v1.2.3