aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-08-31 05:44:38 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-09-20 08:23:21 +0800
commit6cec0789b56add0dddb3c478111fb713c6d432c8 (patch)
treef4502a2a5181aa80e972ea0ba37ab415fb1fffa3
parent1c0c5d923a73cf3542ae41791aa7061922b9db5a (diff)
downloaddexon-solidity-6cec0789b56add0dddb3c478111fb713c6d432c8.tar.gz
dexon-solidity-6cec0789b56add0dddb3c478111fb713c6d432c8.tar.zst
dexon-solidity-6cec0789b56add0dddb3c478111fb713c6d432c8.zip
Limit of scope of variables in SHA3
-rw-r--r--libdevcore/SHA3.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/libdevcore/SHA3.cpp b/libdevcore/SHA3.cpp
index 4d82ec85..b0e40ccb 100644
--- a/libdevcore/SHA3.cpp
+++ b/libdevcore/SHA3.cpp
@@ -97,10 +97,9 @@ static const uint64_t RC[24] = \
static inline void keccakf(void* state) {
uint64_t* a = (uint64_t*)state;
uint64_t b[5] = {0};
- uint64_t t = 0;
- uint8_t x, y;
for (int i = 0; i < 24; i++) {
+ uint8_t x, y;
// Theta
FOR5(x, 1,
b[x] = 0;
@@ -110,7 +109,7 @@ static inline void keccakf(void* state) {
FOR5(y, 5,
a[y + x] ^= b[(x + 4) % 5] ^ rol(b[(x + 1) % 5], 1); ))
// Rho and pi
- t = a[1];
+ uint64_t t = a[1];
x = 0;
REPEAT24(b[0] = a[pi[x]];
a[pi[x]] = rol(t, rho[x]);