mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-27 03:40:22 +00:00
Remove use of temporary t[] for digest calculation. Remove unneeded header. Whitespace
This commit is contained in:
parent
716cd1fed9
commit
cc6702a434
13
siphash.h
13
siphash.h
@ -31,8 +31,6 @@
|
||||
#include "secblock.h"
|
||||
#include "misc.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
template <bool T_128bit>
|
||||
@ -99,7 +97,7 @@ protected:
|
||||
private:
|
||||
FixedSizeSecBlock<word64, 4> m_v;
|
||||
FixedSizeSecBlock<word64, 2> m_k;
|
||||
FixedSizeSecBlock<word64, 1> m_b;
|
||||
FixedSizeSecBlock<word64, 2> m_b;
|
||||
|
||||
// Tail bytes
|
||||
FixedSizeSecBlock<byte, 8> m_acc;
|
||||
@ -235,9 +233,8 @@ void SipHash_Base<C,D,T_128bit>::TruncatedFinal(byte *digest, size_t digestSize)
|
||||
for (unsigned int i=0; i<D; i++)
|
||||
SIPROUND();
|
||||
|
||||
word64 t[2];
|
||||
m_b[0] = m_v[0] ^ m_v[1] ^ m_v[2] ^ m_v[3];
|
||||
t[0] = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, m_b[0]);
|
||||
m_b[0] = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, m_b[0]);
|
||||
|
||||
if (T_128bit)
|
||||
{
|
||||
@ -245,11 +242,11 @@ void SipHash_Base<C,D,T_128bit>::TruncatedFinal(byte *digest, size_t digestSize)
|
||||
for (unsigned int i = 0; i<D; ++i)
|
||||
SIPROUND();
|
||||
|
||||
m_b[0] = m_v[0] ^ m_v[1] ^ m_v[2] ^ m_v[3];
|
||||
t[1] = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, m_b[0]);
|
||||
m_b[1] = m_v[0] ^ m_v[1] ^ m_v[2] ^ m_v[3];
|
||||
m_b[1] = ConditionalByteReverse(LITTLE_ENDIAN_ORDER, m_b[1]);
|
||||
}
|
||||
|
||||
memcpy_s(digest, digestSize, t, STDMIN(digestSize, (size_t)SipHash_Info<T_128bit>::DIGESTSIZE));
|
||||
memcpy_s(digest, digestSize, m_b.begin(), STDMIN(digestSize, (size_t)SipHash_Info<T_128bit>::DIGESTSIZE));
|
||||
Restart();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user