summaryrefslogtreecommitdiff
path: root/sha3.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2016-09-22 10:35:57 -0400
committerJeffrey Walton <noloader@gmail.com>2016-09-22 10:35:57 -0400
commitdcbb0c55d98777a41f9dbd338eba1bb3dd51d453 (patch)
treeb6810dbf0196f104463fe7a72876694ba8856d7c /sha3.cpp
parentd5aff4e4f86ddd8e27db8a6f27670ca3ededc01b (diff)
downloadcryptopp-git-dcbb0c55d98777a41f9dbd338eba1bb3dd51d453.tar.gz
Whitespace cleanup
Diffstat (limited to 'sha3.cpp')
-rw-r--r--sha3.cpp53
1 files changed, 26 insertions, 27 deletions
diff --git a/sha3.cpp b/sha3.cpp
index 435cbd56..2c274fd4 100644
--- a/sha3.cpp
+++ b/sha3.cpp
@@ -48,8 +48,8 @@ static void KeccakF1600(word64 *state)
word64 Esa, Ese, Esi, Eso, Esu;
//copyFromState(A, state)
- typedef BlockGetAndPut<word64, LittleEndian, true, true> Block;
- Block::Get(state)(Aba)(Abe)(Abi)(Abo)(Abu)(Aga)(Age)(Agi)(Ago)(Agu)(Aka)(Ake)(Aki)(Ako)(Aku)(Ama)(Ame)(Ami)(Amo)(Amu)(Asa)(Ase)(Asi)(Aso)(Asu);
+ typedef BlockGetAndPut<word64, LittleEndian, true, true> Block;
+ Block::Get(state)(Aba)(Abe)(Abi)(Abo)(Abu)(Aga)(Age)(Agi)(Ago)(Agu)(Aka)(Ake)(Aki)(Ako)(Aku)(Ama)(Ame)(Ami)(Amo)(Amu)(Asa)(Ase)(Asi)(Aso)(Asu);
for( unsigned int round = 0; round < 24; round += 2 )
{
@@ -245,47 +245,46 @@ static void KeccakF1600(word64 *state)
}
//copyToState(state, A)
- Block::Put(NULL, state)(Aba)(Abe)(Abi)(Abo)(Abu)(Aga)(Age)(Agi)(Ago)(Agu)(Aka)(Ake)(Aki)(Ako)(Aku)(Ama)(Ame)(Ami)(Amo)(Amu)(Asa)(Ase)(Asi)(Aso)(Asu);
+ Block::Put(NULL, state)(Aba)(Abe)(Abi)(Abo)(Abu)(Aga)(Age)(Agi)(Ago)(Agu)(Aka)(Ake)(Aki)(Ako)(Aku)(Ama)(Ame)(Ami)(Amo)(Amu)(Asa)(Ase)(Asi)(Aso)(Asu);
}
}
void SHA3::Update(const byte *input, size_t length)
{
- CRYPTOPP_ASSERT((input && length) || !(input || length));
- if (!length)
- return;
+ CRYPTOPP_ASSERT((input && length) || !(input || length));
+ if (!length) { return; }
- size_t spaceLeft;
- while (length >= (spaceLeft = r() - m_counter))
- {
- if (spaceLeft)
- xorbuf(m_state.BytePtr() + m_counter, input, spaceLeft);
- KeccakF1600(m_state);
- input += spaceLeft;
- length -= spaceLeft;
- m_counter = 0;
- }
+ size_t spaceLeft;
+ while (length >= (spaceLeft = r() - m_counter))
+ {
+ if (spaceLeft)
+ xorbuf(m_state.BytePtr() + m_counter, input, spaceLeft);
+ KeccakF1600(m_state);
+ input += spaceLeft;
+ length -= spaceLeft;
+ m_counter = 0;
+ }
- if (length)
- xorbuf(m_state.BytePtr() + m_counter, input, length);
- m_counter += (unsigned int)length;
+ if (length)
+ xorbuf(m_state.BytePtr() + m_counter, input, length);
+ m_counter += (unsigned int)length;
}
void SHA3::Restart()
{
- memset(m_state, 0, m_state.SizeInBytes());
- m_counter = 0;
+ memset(m_state, 0, m_state.SizeInBytes());
+ m_counter = 0;
}
void SHA3::TruncatedFinal(byte *hash, size_t size)
{
- ThrowIfInvalidTruncatedSize(size);
+ ThrowIfInvalidTruncatedSize(size);
- m_state.BytePtr()[m_counter] ^= 0x06;
- m_state.BytePtr()[r()-1] ^= 0x80;
- KeccakF1600(m_state);
- memcpy(hash, m_state, size);
- Restart();
+ m_state.BytePtr()[m_counter] ^= 0x06;
+ m_state.BytePtr()[r()-1] ^= 0x80;
+ KeccakF1600(m_state);
+ memcpy(hash, m_state, size);
+ Restart();
}
NAMESPACE_END