aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/hash
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-01-08 19:15:29 -0500
committerJack Lloyd <[email protected]>2016-01-08 19:18:13 -0500
commite33ca7736bc7b0b66ae14e8d3e879b58b2924239 (patch)
tree58459585e6675cd799b6ef5900be026825cd6f9d /src/lib/hash
parent2fbfdd7e5afb5e888fd8c0b56c6df09e2bdeaca7 (diff)
parentd22bc10cd4f67924acd82bcd46a31e3de3b20ce3 (diff)
Merge GH #398 Mass prefix all member vars with m_
Diffstat (limited to 'src/lib/hash')
-rw-r--r--src/lib/hash/checksum/adler32/adler32.cpp6
-rw-r--r--src/lib/hash/checksum/adler32/adler32.h4
-rw-r--r--src/lib/hash/checksum/crc24/crc24.cpp6
-rw-r--r--src/lib/hash/checksum/crc24/crc24.h4
-rw-r--r--src/lib/hash/checksum/crc32/crc32.cpp8
-rw-r--r--src/lib/hash/checksum/crc32/crc32.h4
-rw-r--r--src/lib/hash/gost_3411/gost_3411.cpp68
-rw-r--r--src/lib/hash/gost_3411/gost_3411.h8
-rw-r--r--src/lib/hash/has160/has160.cpp152
-rw-r--r--src/lib/hash/has160/has160.h4
-rw-r--r--src/lib/hash/keccak/keccak.cpp44
-rw-r--r--src/lib/hash/keccak/keccak.h10
-rw-r--r--src/lib/hash/md2/md2.cpp50
-rw-r--r--src/lib/hash/md2/md2.h6
-rw-r--r--src/lib/hash/md4/md4.cpp80
-rw-r--r--src/lib/hash/md4/md4.h6
-rw-r--r--src/lib/hash/md5/md5.cpp98
-rw-r--r--src/lib/hash/md5/md5.h6
-rw-r--r--src/lib/hash/mdx_hash/mdx_hash.cpp50
-rw-r--r--src/lib/hash/mdx_hash/mdx_hash.h8
-rw-r--r--src/lib/hash/par_hash/par_hash.cpp20
-rw-r--r--src/lib/hash/par_hash/par_hash.h2
-rw-r--r--src/lib/hash/rmd128/rmd128.cpp168
-rw-r--r--src/lib/hash/rmd128/rmd128.h4
-rw-r--r--src/lib/hash/rmd160/rmd160.cpp208
-rw-r--r--src/lib/hash/rmd160/rmd160.h4
-rw-r--r--src/lib/hash/sha1/sha160.cpp134
-rw-r--r--src/lib/hash/sha1/sha160.h8
-rw-r--r--src/lib/hash/sha1_sse2/sha1_sse2.cpp20
-rw-r--r--src/lib/hash/sha2_32/sha2_32.cpp40
-rw-r--r--src/lib/hash/sha2_32/sha2_32.h8
-rw-r--r--src/lib/hash/skein/skein_512.cpp72
-rw-r--r--src/lib/hash/skein/skein_512.h12
-rw-r--r--src/lib/hash/tiger/tiger.cpp42
-rw-r--r--src/lib/hash/tiger/tiger.h8
-rw-r--r--src/lib/hash/whirlpool/whirlpool.cpp32
-rw-r--r--src/lib/hash/whirlpool/whrlpool.h4
37 files changed, 704 insertions, 704 deletions
diff --git a/src/lib/hash/checksum/adler32/adler32.cpp b/src/lib/hash/checksum/adler32/adler32.cpp
index f368b627c..304c664dd 100644
--- a/src/lib/hash/checksum/adler32/adler32.cpp
+++ b/src/lib/hash/checksum/adler32/adler32.cpp
@@ -61,12 +61,12 @@ void Adler32::add_data(const byte input[], size_t length)
while(length >= PROCESS_AMOUNT)
{
- adler32_update(input, PROCESS_AMOUNT, S1, S2);
+ adler32_update(input, PROCESS_AMOUNT, m_S1, m_S2);
input += PROCESS_AMOUNT;
length -= PROCESS_AMOUNT;
}
- adler32_update(input, length, S1, S2);
+ adler32_update(input, length, m_S1, m_S2);
}
/*
@@ -74,7 +74,7 @@ void Adler32::add_data(const byte input[], size_t length)
*/
void Adler32::final_result(byte output[])
{
- store_be(output, S2, S1);
+ store_be(output, m_S2, m_S1);
clear();
}
diff --git a/src/lib/hash/checksum/adler32/adler32.h b/src/lib/hash/checksum/adler32/adler32.h
index 307236d6d..c42c184c9 100644
--- a/src/lib/hash/checksum/adler32/adler32.h
+++ b/src/lib/hash/checksum/adler32/adler32.h
@@ -22,14 +22,14 @@ class BOTAN_DLL Adler32 : public HashFunction
size_t output_length() const override { return 4; }
HashFunction* clone() const override { return new Adler32; }
- void clear() override { S1 = 1; S2 = 0; }
+ void clear() override { m_S1 = 1; m_S2 = 0; }
Adler32() { clear(); }
~Adler32() { clear(); }
private:
void add_data(const byte[], size_t) override;
void final_result(byte[]) override;
- u16bit S1, S2;
+ u16bit m_S1, m_S2;
};
}
diff --git a/src/lib/hash/checksum/crc24/crc24.cpp b/src/lib/hash/checksum/crc24/crc24.cpp
index 1484f643d..6f1eea453 100644
--- a/src/lib/hash/checksum/crc24/crc24.cpp
+++ b/src/lib/hash/checksum/crc24/crc24.cpp
@@ -60,7 +60,7 @@ void CRC24::add_data(const byte input[], size_t length)
0x00FA48FA, 0x007C0401, 0x0042FA2F, 0x00C4B6D4, 0x00C82F22, 0x004E63D9,
0x00D11CCE, 0x00575035, 0x005BC9C3, 0x00DD8538 };
- u32bit tmp = crc;
+ u32bit tmp = m_crc;
while(length >= 16)
{
tmp = TABLE[((tmp >> 16) ^ input[ 0]) & 0xFF] ^ (tmp << 8);
@@ -86,7 +86,7 @@ void CRC24::add_data(const byte input[], size_t length)
for(size_t i = 0; i != length; ++i)
tmp = TABLE[((tmp >> 16) ^ input[i]) & 0xFF] ^ (tmp << 8);
- crc = tmp;
+ m_crc = tmp;
}
/*
@@ -95,7 +95,7 @@ void CRC24::add_data(const byte input[], size_t length)
void CRC24::final_result(byte output[])
{
for(size_t i = 0; i != 3; ++i)
- output[i] = get_byte(i+1, crc);
+ output[i] = get_byte(i+1, m_crc);
clear();
}
diff --git a/src/lib/hash/checksum/crc24/crc24.h b/src/lib/hash/checksum/crc24/crc24.h
index 8df8bd727..8e9ce9315 100644
--- a/src/lib/hash/checksum/crc24/crc24.h
+++ b/src/lib/hash/checksum/crc24/crc24.h
@@ -22,14 +22,14 @@ class BOTAN_DLL CRC24 : public HashFunction
size_t output_length() const override { return 3; }
HashFunction* clone() const override { return new CRC24; }
- void clear() override { crc = 0xB704CE; }
+ void clear() override { m_crc = 0xB704CE; }
CRC24() { clear(); }
~CRC24() { clear(); }
private:
void add_data(const byte[], size_t) override;
void final_result(byte[]) override;
- u32bit crc;
+ u32bit m_crc;
};
}
diff --git a/src/lib/hash/checksum/crc32/crc32.cpp b/src/lib/hash/checksum/crc32/crc32.cpp
index 10d989cc6..ca8c87c5f 100644
--- a/src/lib/hash/checksum/crc32/crc32.cpp
+++ b/src/lib/hash/checksum/crc32/crc32.cpp
@@ -60,7 +60,7 @@ void CRC32::add_data(const byte input[], size_t length)
0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D };
- u32bit tmp = crc;
+ u32bit tmp = m_crc;
while(length >= 16)
{
tmp = TABLE[(tmp ^ input[ 0]) & 0xFF] ^ (tmp >> 8);
@@ -86,7 +86,7 @@ void CRC32::add_data(const byte input[], size_t length)
for(size_t i = 0; i != length; ++i)
tmp = TABLE[(tmp ^ input[i]) & 0xFF] ^ (tmp >> 8);
- crc = tmp;
+ m_crc = tmp;
}
/*
@@ -94,8 +94,8 @@ void CRC32::add_data(const byte input[], size_t length)
*/
void CRC32::final_result(byte output[])
{
- crc ^= 0xFFFFFFFF;
- store_be(crc, output);
+ m_crc ^= 0xFFFFFFFF;
+ store_be(m_crc, output);
clear();
}
diff --git a/src/lib/hash/checksum/crc32/crc32.h b/src/lib/hash/checksum/crc32/crc32.h
index 8ae95d42a..98c9a020c 100644
--- a/src/lib/hash/checksum/crc32/crc32.h
+++ b/src/lib/hash/checksum/crc32/crc32.h
@@ -22,14 +22,14 @@ class BOTAN_DLL CRC32 : public HashFunction
size_t output_length() const override { return 4; }
HashFunction* clone() const override { return new CRC32; }
- void clear() override { crc = 0xFFFFFFFF; }
+ void clear() override { m_crc = 0xFFFFFFFF; }
CRC32() { clear(); }
~CRC32() { clear(); }
private:
void add_data(const byte[], size_t) override;
void final_result(byte[]) override;
- u32bit crc;
+ u32bit m_crc;
};
}
diff --git a/src/lib/hash/gost_3411/gost_3411.cpp b/src/lib/hash/gost_3411/gost_3411.cpp
index f8c9c0069..17c590a5c 100644
--- a/src/lib/hash/gost_3411/gost_3411.cpp
+++ b/src/lib/hash/gost_3411/gost_3411.cpp
@@ -13,22 +13,22 @@ namespace Botan {
* GOST 34.11 Constructor
*/
GOST_34_11::GOST_34_11() :
- cipher(GOST_28147_89_Params("R3411_CryptoPro")),
- buffer(32),
- sum(32),
- hash(32)
+ m_cipher(GOST_28147_89_Params("R3411_CryptoPro")),
+ m_buffer(32),
+ m_sum(32),
+ m_hash(32)
{
- count = 0;
- position = 0;
+ m_count = 0;
+ m_position = 0;
}
void GOST_34_11::clear()
{
- cipher.clear();
- zeroise(sum);
- zeroise(hash);
- count = 0;
- position = 0;
+ m_cipher.clear();
+ zeroise(m_sum);
+ zeroise(m_hash);
+ m_count = 0;
+ m_position = 0;
}
/**
@@ -36,18 +36,18 @@ void GOST_34_11::clear()
*/
void GOST_34_11::add_data(const byte input[], size_t length)
{
- count += length;
+ m_count += length;
- if(position)
+ if(m_position)
{
- buffer_insert(buffer, position, input, length);
+ buffer_insert(m_buffer, m_position, input, length);
- if(position + length >= hash_block_size())
+ if(m_position + length >= hash_block_size())
{
- compress_n(buffer.data(), 1);
- input += (hash_block_size() - position);
- length -= (hash_block_size() - position);
- position = 0;
+ compress_n(m_buffer.data(), 1);
+ input += (hash_block_size() - m_position);
+ length -= (hash_block_size() - m_position);
+ m_position = 0;
}
}
@@ -57,8 +57,8 @@ void GOST_34_11::add_data(const byte input[], size_t length)
if(full_blocks)
compress_n(input, full_blocks);
- buffer_insert(buffer, position, input + full_blocks * hash_block_size(), remaining);
- position += remaining;
+ buffer_insert(m_buffer, m_position, input + full_blocks * hash_block_size(), remaining);
+ m_position += remaining;
}
/**
@@ -70,15 +70,15 @@ void GOST_34_11::compress_n(const byte input[], size_t blocks)
{
for(u16bit j = 0, carry = 0; j != 32; ++j)
{
- u16bit s = sum[j] + input[32*i+j] + carry;
+ u16bit s = m_sum[j] + input[32*i+j] + carry;
carry = get_byte(0, s);
- sum[j] = get_byte(1, s);
+ m_sum[j] = get_byte(1, s);
}
byte S[32] = { 0 };
u64bit U[4], V[4];
- load_be(U, hash.data(), 4);
+ load_be(U, m_hash.data(), 4);
load_be(V, input + 32*i, 4);
for(size_t j = 0; j != 4; ++j)
@@ -90,8 +90,8 @@ void GOST_34_11::compress_n(const byte input[], size_t blocks)
for(size_t l = 0; l != 8; ++l)
key[4*l+k] = get_byte(l, U[k]) ^ get_byte(l, V[k]);
- cipher.set_key(key, 32);
- cipher.encrypt(&hash[8*j], S + 8*j);
+ m_cipher.set_key(key, 32);
+ m_cipher.encrypt(&m_hash[8*j], S + 8*j);
if(j == 3)
break;
@@ -165,7 +165,7 @@ void GOST_34_11::compress_n(const byte input[], size_t blocks)
S[30] = S2[0];
S[31] = S2[1];
- xor_buf(S, hash.data(), 32);
+ xor_buf(S, m_hash.data(), 32);
// 61 rounds of psi
S2[ 0] = S[ 2] ^ S[ 6] ^ S[14] ^ S[20] ^ S[22] ^ S[26] ^ S[28] ^ S[30];
@@ -207,7 +207,7 @@ void GOST_34_11::compress_n(const byte input[], size_t blocks)
S2[30] = S[ 2] ^ S[ 4] ^ S[ 8] ^ S[14] ^ S[16] ^ S[18] ^ S[22] ^ S[24] ^ S[28] ^ S[30];
S2[31] = S[ 3] ^ S[ 5] ^ S[ 9] ^ S[15] ^ S[17] ^ S[19] ^ S[23] ^ S[25] ^ S[29] ^ S[31];
- copy_mem(hash.data(), S2, 32);
+ copy_mem(m_hash.data(), S2, 32);
}
}
@@ -216,22 +216,22 @@ void GOST_34_11::compress_n(const byte input[], size_t blocks)
*/
void GOST_34_11::final_result(byte out[])
{
- if(position)
+ if(m_position)
{
- clear_mem(buffer.data() + position, buffer.size() - position);
- compress_n(buffer.data(), 1);
+ clear_mem(m_buffer.data() + m_position, m_buffer.size() - m_position);
+ compress_n(m_buffer.data(), 1);
}
secure_vector<byte> length_buf(32);
- const u64bit bit_count = count * 8;
+ const u64bit bit_count = m_count * 8;
store_le(bit_count, length_buf.data());
- secure_vector<byte> sum_buf = sum;
+ secure_vector<byte> sum_buf = m_sum;
compress_n(length_buf.data(), 1);
compress_n(sum_buf.data(), 1);
- copy_mem(out, hash.data(), 32);
+ copy_mem(out, m_hash.data(), 32);
clear();
}
diff --git a/src/lib/hash/gost_3411/gost_3411.h b/src/lib/hash/gost_3411/gost_3411.h
index 2ad96dbdb..326873d38 100644
--- a/src/lib/hash/gost_3411/gost_3411.h
+++ b/src/lib/hash/gost_3411/gost_3411.h
@@ -33,10 +33,10 @@ class BOTAN_DLL GOST_34_11 : public HashFunction
void add_data(const byte[], size_t) override;
void final_result(byte[]) override;
- GOST_28147_89 cipher;
- secure_vector<byte> buffer, sum, hash;
- size_t position;
- u64bit count;
+ GOST_28147_89 m_cipher;
+ secure_vector<byte> m_buffer, m_sum, m_hash;
+ size_t m_position;
+ u64bit m_count;
};
}
diff --git a/src/lib/hash/has160/has160.cpp b/src/lib/hash/has160/has160.cpp
index 6b12e10ad..114b5f8b5 100644
--- a/src/lib/hash/has160/has160.cpp
+++ b/src/lib/hash/has160/has160.cpp
@@ -60,78 +60,78 @@ void HAS_160::compress_n(const byte input[], size_t blocks)
{
using namespace HAS_160_F;
- u32bit A = digest[0], B = digest[1], C = digest[2],
- D = digest[3], E = digest[4];
+ u32bit A = m_digest[0], B = m_digest[1], C = m_digest[2],
+ D = m_digest[3], E = m_digest[4];
for(size_t i = 0; i != blocks; ++i)
{
- load_le(X.data(), input, 16);
-
- X[16] = X[ 0] ^ X[ 1] ^ X[ 2] ^ X[ 3];
- X[17] = X[ 4] ^ X[ 5] ^ X[ 6] ^ X[ 7];
- X[18] = X[ 8] ^ X[ 9] ^ X[10] ^ X[11];
- X[19] = X[12] ^ X[13] ^ X[14] ^ X[15];
- F1(A,B,C,D,E,X[18], 5); F1(E,A,B,C,D,X[ 0],11);
- F1(D,E,A,B,C,X[ 1], 7); F1(C,D,E,A,B,X[ 2],15);
- F1(B,C,D,E,A,X[ 3], 6); F1(A,B,C,D,E,X[19],13);
- F1(E,A,B,C,D,X[ 4], 8); F1(D,E,A,B,C,X[ 5],14);
- F1(C,D,E,A,B,X[ 6], 7); F1(B,C,D,E,A,X[ 7],12);
- F1(A,B,C,D,E,X[16], 9); F1(E,A,B,C,D,X[ 8],11);
- F1(D,E,A,B,C,X[ 9], 8); F1(C,D,E,A,B,X[10],15);
- F1(B,C,D,E,A,X[11], 6); F1(A,B,C,D,E,X[17],12);
- F1(E,A,B,C,D,X[12], 9); F1(D,E,A,B,C,X[13],14);
- F1(C,D,E,A,B,X[14], 5); F1(B,C,D,E,A,X[15],13);
-
- X[16] = X[ 3] ^ X[ 6] ^ X[ 9] ^ X[12];
- X[17] = X[ 2] ^ X[ 5] ^ X[ 8] ^ X[15];
- X[18] = X[ 1] ^ X[ 4] ^ X[11] ^ X[14];
- X[19] = X[ 0] ^ X[ 7] ^ X[10] ^ X[13];
- F2(A,B,C,D,E,X[18], 5); F2(E,A,B,C,D,X[ 3],11);
- F2(D,E,A,B,C,X[ 6], 7); F2(C,D,E,A,B,X[ 9],15);
- F2(B,C,D,E,A,X[12], 6); F2(A,B,C,D,E,X[19],13);
- F2(E,A,B,C,D,X[15], 8); F2(D,E,A,B,C,X[ 2],14);
- F2(C,D,E,A,B,X[ 5], 7); F2(B,C,D,E,A,X[ 8],12);
- F2(A,B,C,D,E,X[16], 9); F2(E,A,B,C,D,X[11],11);
- F2(D,E,A,B,C,X[14], 8); F2(C,D,E,A,B,X[ 1],15);
- F2(B,C,D,E,A,X[ 4], 6); F2(A,B,C,D,E,X[17],12);
- F2(E,A,B,C,D,X[ 7], 9); F2(D,E,A,B,C,X[10],14);
- F2(C,D,E,A,B,X[13], 5); F2(B,C,D,E,A,X[ 0],13);
-
- X[16] = X[ 5] ^ X[ 7] ^ X[12] ^ X[14];
- X[17] = X[ 0] ^ X[ 2] ^ X[ 9] ^ X[11];
- X[18] = X[ 4] ^ X[ 6] ^ X[13] ^ X[15];
- X[19] = X[ 1] ^ X[ 3] ^ X[ 8] ^ X[10];
- F3(A,B,C,D,E,X[18], 5); F3(E,A,B,C,D,X[12],11);
- F3(D,E,A,B,C,X[ 5], 7); F3(C,D,E,A,B,X[14],15);
- F3(B,C,D,E,A,X[ 7], 6); F3(A,B,C,D,E,X[19],13);
- F3(E,A,B,C,D,X[ 0], 8); F3(D,E,A,B,C,X[ 9],14);
- F3(C,D,E,A,B,X[ 2], 7); F3(B,C,D,E,A,X[11],12);
- F3(A,B,C,D,E,X[16], 9); F3(E,A,B,C,D,X[ 4],11);
- F3(D,E,A,B,C,X[13], 8); F3(C,D,E,A,B,X[ 6],15);
- F3(B,C,D,E,A,X[15], 6); F3(A,B,C,D,E,X[17],12);
- F3(E,A,B,C,D,X[ 8], 9); F3(D,E,A,B,C,X[ 1],14);
- F3(C,D,E,A,B,X[10], 5); F3(B,C,D,E,A,X[ 3],13);
-
- X[16] = X[ 2] ^ X[ 7] ^ X[ 8] ^ X[13];
- X[17] = X[ 3] ^ X[ 4] ^ X[ 9] ^ X[14];
- X[18] = X[ 0] ^ X[ 5] ^ X[10] ^ X[15];
- X[19] = X[ 1] ^ X[ 6] ^ X[11] ^ X[12];
- F4(A,B,C,D,E,X[18], 5); F4(E,A,B,C,D,X[ 7],11);
- F4(D,E,A,B,C,X[ 2], 7); F4(C,D,E,A,B,X[13],15);
- F4(B,C,D,E,A,X[ 8], 6); F4(A,B,C,D,E,X[19],13);
- F4(E,A,B,C,D,X[ 3], 8); F4(D,E,A,B,C,X[14],14);
- F4(C,D,E,A,B,X[ 9], 7); F4(B,C,D,E,A,X[ 4],12);
- F4(A,B,C,D,E,X[16], 9); F4(E,A,B,C,D,X[15],11);
- F4(D,E,A,B,C,X[10], 8); F4(C,D,E,A,B,X[ 5],15);
- F4(B,C,D,E,A,X[ 0], 6); F4(A,B,C,D,E,X[17],12);
- F4(E,A,B,C,D,X[11], 9); F4(D,E,A,B,C,X[ 6],14);
- F4(C,D,E,A,B,X[ 1], 5); F4(B,C,D,E,A,X[12],13);
-
- A = (digest[0] += A);
- B = (digest[1] += B);
- C = (digest[2] += C);
- D = (digest[3] += D);
- E = (digest[4] += E);
+ load_le(m_X.data(), input, 16);
+
+ m_X[16] = m_X[ 0] ^ m_X[ 1] ^ m_X[ 2] ^ m_X[ 3];
+ m_X[17] = m_X[ 4] ^ m_X[ 5] ^ m_X[ 6] ^ m_X[ 7];
+ m_X[18] = m_X[ 8] ^ m_X[ 9] ^ m_X[10] ^ m_X[11];
+ m_X[19] = m_X[12] ^ m_X[13] ^ m_X[14] ^ m_X[15];
+ F1(A,B,C,D,E,m_X[18], 5); F1(E,A,B,C,D,m_X[ 0],11);
+ F1(D,E,A,B,C,m_X[ 1], 7); F1(C,D,E,A,B,m_X[ 2],15);
+ F1(B,C,D,E,A,m_X[ 3], 6); F1(A,B,C,D,E,m_X[19],13);
+ F1(E,A,B,C,D,m_X[ 4], 8); F1(D,E,A,B,C,m_X[ 5],14);
+ F1(C,D,E,A,B,m_X[ 6], 7); F1(B,C,D,E,A,m_X[ 7],12);
+ F1(A,B,C,D,E,m_X[16], 9); F1(E,A,B,C,D,m_X[ 8],11);
+ F1(D,E,A,B,C,m_X[ 9], 8); F1(C,D,E,A,B,m_X[10],15);
+ F1(B,C,D,E,A,m_X[11], 6); F1(A,B,C,D,E,m_X[17],12);
+ F1(E,A,B,C,D,m_X[12], 9); F1(D,E,A,B,C,m_X[13],14);
+ F1(C,D,E,A,B,m_X[14], 5); F1(B,C,D,E,A,m_X[15],13);
+
+ m_X[16] = m_X[ 3] ^ m_X[ 6] ^ m_X[ 9] ^ m_X[12];
+ m_X[17] = m_X[ 2] ^ m_X[ 5] ^ m_X[ 8] ^ m_X[15];
+ m_X[18] = m_X[ 1] ^ m_X[ 4] ^ m_X[11] ^ m_X[14];
+ m_X[19] = m_X[ 0] ^ m_X[ 7] ^ m_X[10] ^ m_X[13];
+ F2(A,B,C,D,E,m_X[18], 5); F2(E,A,B,C,D,m_X[ 3],11);
+ F2(D,E,A,B,C,m_X[ 6], 7); F2(C,D,E,A,B,m_X[ 9],15);
+ F2(B,C,D,E,A,m_X[12], 6); F2(A,B,C,D,E,m_X[19],13);
+ F2(E,A,B,C,D,m_X[15], 8); F2(D,E,A,B,C,m_X[ 2],14);
+ F2(C,D,E,A,B,m_X[ 5], 7); F2(B,C,D,E,A,m_X[ 8],12);
+ F2(A,B,C,D,E,m_X[16], 9); F2(E,A,B,C,D,m_X[11],11);
+ F2(D,E,A,B,C,m_X[14], 8); F2(C,D,E,A,B,m_X[ 1],15);
+ F2(B,C,D,E,A,m_X[ 4], 6); F2(A,B,C,D,E,m_X[17],12);
+ F2(E,A,B,C,D,m_X[ 7], 9); F2(D,E,A,B,C,m_X[10],14);
+ F2(C,D,E,A,B,m_X[13], 5); F2(B,C,D,E,A,m_X[ 0],13);
+
+ m_X[16] = m_X[ 5] ^ m_X[ 7] ^ m_X[12] ^ m_X[14];
+ m_X[17] = m_X[ 0] ^ m_X[ 2] ^ m_X[ 9] ^ m_X[11];
+ m_X[18] = m_X[ 4] ^ m_X[ 6] ^ m_X[13] ^ m_X[15];
+ m_X[19] = m_X[ 1] ^ m_X[ 3] ^ m_X[ 8] ^ m_X[10];
+ F3(A,B,C,D,E,m_X[18], 5); F3(E,A,B,C,D,m_X[12],11);
+ F3(D,E,A,B,C,m_X[ 5], 7); F3(C,D,E,A,B,m_X[14],15);
+ F3(B,C,D,E,A,m_X[ 7], 6); F3(A,B,C,D,E,m_X[19],13);
+ F3(E,A,B,C,D,m_X[ 0], 8); F3(D,E,A,B,C,m_X[ 9],14);
+ F3(C,D,E,A,B,m_X[ 2], 7); F3(B,C,D,E,A,m_X[11],12);
+ F3(A,B,C,D,E,m_X[16], 9); F3(E,A,B,C,D,m_X[ 4],11);
+ F3(D,E,A,B,C,m_X[13], 8); F3(C,D,E,A,B,m_X[ 6],15);
+ F3(B,C,D,E,A,m_X[15], 6); F3(A,B,C,D,E,m_X[17],12);
+ F3(E,A,B,C,D,m_X[ 8], 9); F3(D,E,A,B,C,m_X[ 1],14);
+ F3(C,D,E,A,B,m_X[10], 5); F3(B,C,D,E,A,m_X[ 3],13);
+
+ m_X[16] = m_X[ 2] ^ m_X[ 7] ^ m_X[ 8] ^ m_X[13];
+ m_X[17] = m_X[ 3] ^ m_X[ 4] ^ m_X[ 9] ^ m_X[14];
+ m_X[18] = m_X[ 0] ^ m_X[ 5] ^ m_X[10] ^ m_X[15];
+ m_X[19] = m_X[ 1] ^ m_X[ 6] ^ m_X[11] ^ m_X[12];
+ F4(A,B,C,D,E,m_X[18], 5); F4(E,A,B,C,D,m_X[ 7],11);
+ F4(D,E,A,B,C,m_X[ 2], 7); F4(C,D,E,A,B,m_X[13],15);
+ F4(B,C,D,E,A,m_X[ 8], 6); F4(A,B,C,D,E,m_X[19],13);
+ F4(E,A,B,C,D,m_X[ 3], 8); F4(D,E,A,B,C,m_X[14],14);
+ F4(C,D,E,A,B,m_X[ 9], 7); F4(B,C,D,E,A,m_X[ 4],12);
+ F4(A,B,C,D,E,m_X[16], 9); F4(E,A,B,C,D,m_X[15],11);
+ F4(D,E,A,B,C,m_X[10], 8); F4(C,D,E,A,B,m_X[ 5],15);
+ F4(B,C,D,E,A,m_X[ 0], 6); F4(A,B,C,D,E,m_X[17],12);
+ F4(E,A,B,C,D,m_X[11], 9); F4(D,E,A,B,C,m_X[ 6],14);
+ F4(C,D,E,A,B,m_X[ 1], 5); F4(B,C,D,E,A,m_X[12],13);
+
+ A = (m_digest[0] += A);
+ B = (m_digest[1] += B);
+ C = (m_digest[2] += C);
+ D = (m_digest[3] += D);
+ E = (m_digest[4] += E);
input += hash_block_size();
}
@@ -142,7 +142,7 @@ void HAS_160::compress_n(const byte input[], size_t blocks)
*/
void HAS_160::copy_out(byte output[])
{
- copy_out_vec_le(output, output_length(), digest);
+ copy_out_vec_le(output, output_length(), m_digest);
}
/*
@@ -151,12 +151,12 @@ void HAS_160::copy_out(byte output[])
void HAS_160::clear()
{
MDx_HashFunction::clear();
- zeroise(X);
- digest[0] = 0x67452301;
- digest[1] = 0xEFCDAB89;
- digest[2] = 0x98BADCFE;
- digest[3] = 0x10325476;
- digest[4] = 0xC3D2E1F0;
+ zeroise(m_X);
+ m_digest[0] = 0x67452301;
+ m_digest[1] = 0xEFCDAB89;
+ m_digest[2] = 0x98BADCFE;
+ m_digest[3] = 0x10325476;
+ m_digest[4] = 0xC3D2E1F0;
}
}
diff --git a/src/lib/hash/has160/has160.h b/src/lib/hash/has160/has160.h
index 75d0bda90..ca9be03b0 100644
--- a/src/lib/hash/has160/has160.h
+++ b/src/lib/hash/has160/has160.h
@@ -25,13 +25,13 @@ class BOTAN_DLL HAS_160 : public MDx_HashFunction
void clear() override;
- HAS_160() : MDx_HashFunction(64, false, true), X(20), digest(5)
+ HAS_160() : MDx_HashFunction(64, false, true), m_X(20), m_digest(5)
{ clear(); }
private:
void compress_n(const byte[], size_t blocks) override;
void copy_out(byte[]) override;
- secure_vector<u32bit> X, digest;
+ secure_vector<u32bit> m_X, m_digest;
};
}
diff --git a/src/lib/hash/keccak/keccak.cpp b/src/lib/hash/keccak/keccak.cpp
index 39d0c822b..c0b430a8f 100644
--- a/src/lib/hash/keccak/keccak.cpp
+++ b/src/lib/hash/keccak/keccak.cpp
@@ -99,10 +99,10 @@ void keccak_f_1600(u64bit A[25])
}
Keccak_1600::Keccak_1600(size_t output_bits) :
- output_bits(output_bits),
- bitrate(1600 - 2*output_bits),
- S(25),
- S_pos(0)
+ m_output_bits(output_bits),
+ m_bitrate(1600 - 2*output_bits),
+ m_S(25),
+ m_S_pos(0)
{
// We only support the parameters for the SHA-3 proposal
@@ -114,18 +114,18 @@ Keccak_1600::Keccak_1600(size_t output_bits) :
std::string Keccak_1600::name() const
{
- return "Keccak-1600(" + std::to_string(output_bits) + ")";
+ return "Keccak-1600(" + std::to_string(m_output_bits) + ")";
}
HashFunction* Keccak_1600::clone() const
{
- return new Keccak_1600(output_bits);
+ return new Keccak_1600(m_output_bits);
}
void Keccak_1600::clear()
{
- zeroise(S);
- S_pos = 0;
+ zeroise(m_S);
+ m_S_pos = 0;
}
void Keccak_1600::add_data(const byte input[], size_t length)
@@ -135,47 +135,47 @@ void Keccak_1600::add_data(const byte input[], size_t length)
while(length)
{
- size_t to_take = std::min(length, bitrate / 8 - S_pos);
+ size_t to_take = std::min(length, m_bitrate / 8 - m_S_pos);
length -= to_take;
- while(to_take && S_pos % 8)
+ while(to_take && m_S_pos % 8)
{
- S[S_pos / 8] ^= static_cast<u64bit>(input[0]) << (8 * (S_pos % 8));
+ m_S[m_S_pos / 8] ^= static_cast<u64bit>(input[0]) << (8 * (m_S_pos % 8));
- ++S_pos;
+ ++m_S_pos;
++input;
--to_take;
}
while(to_take && to_take % 8 == 0)
{
- S[S_pos / 8] ^= load_le<u64bit>(input, 0);
- S_pos += 8;
+ m_S[m_S_pos / 8] ^= load_le<u64bit>(input, 0);
+ m_S_pos += 8;
input += 8;
to_take -= 8;
}
while(to_take)
{
- S[S_pos / 8] ^= static_cast<u64bit>(input[0]) << (8 * (S_pos % 8));
+ m_S[m_S_pos / 8] ^= static_cast<u64bit>(input[0]) << (8 * (m_S_pos % 8));
- ++S_pos;
+ ++m_S_pos;
++input;
--to_take;
}
- if(S_pos == bitrate / 8)
+ if(m_S_pos == m_bitrate / 8)
{
- keccak_f_1600(S.data());
- S_pos = 0;
+ keccak_f_1600(m_S.data());
+ m_S_pos = 0;
}
}
}
void Keccak_1600::final_result(byte output[])
{
- std::vector<byte> padding(bitrate / 8 - S_pos);
+ std::vector<byte> padding(m_bitrate / 8 - m_S_pos);
padding[0] = 0x01;
padding[padding.size()-1] |= 0x80;
@@ -186,8 +186,8 @@ void Keccak_1600::final_result(byte output[])
* We never have to run the permutation again because we only support
* limited output lengths
*/
- for(size_t i = 0; i != output_bits/8; ++i)
- output[i] = get_byte(7 - (i % 8), S[i/8]);
+ for(size_t i = 0; i != m_output_bits/8; ++i)
+ output[i] = get_byte(7 - (i % 8), m_S[i/8]);
clear();
}
diff --git a/src/lib/hash/keccak/keccak.h b/src/lib/hash/keccak/keccak.h
index 0e7d3d5d1..c08b6c4e4 100644
--- a/src/lib/hash/keccak/keccak.h
+++ b/src/lib/hash/keccak/keccak.h
@@ -27,8 +27,8 @@ class BOTAN_DLL Keccak_1600 : public HashFunction
*/
Keccak_1600(size_t output_bits = 512);
- size_t hash_block_size() const override { return bitrate / 8; }
- size_t output_length() const override { return output_bits / 8; }
+ size_t hash_block_size() const override { return m_bitrate / 8; }
+ size_t output_length() const override { return m_output_bits / 8; }
HashFunction* clone() const override;
std::string name() const override;
@@ -37,9 +37,9 @@ class BOTAN_DLL Keccak_1600 : public HashFunction
void add_data(const byte input[], size_t length) override;
void final_result(byte out[]) override;
- size_t output_bits, bitrate;
- secure_vector<u64bit> S;
- size_t S_pos;
+ size_t m_output_bits, m_bitrate;
+ secure_vector<u64bit> m_S;
+ size_t m_S_pos;
};
}
diff --git a/src/lib/hash/md2/md2.cpp b/src/lib/hash/md2/md2.cpp
index 8fe016962..f5e222610 100644
--- a/src/lib/hash/md2/md2.cpp
+++ b/src/lib/hash/md2/md2.cpp
@@ -38,26 +38,26 @@ void MD2::hash(const byte input[])
0x31, 0x44, 0x50, 0xB4, 0x8F, 0xED, 0x1F, 0x1A, 0xDB, 0x99, 0x8D, 0x33,
0x9F, 0x11, 0x83, 0x14 };
- buffer_insert(X, 16, input, hash_block_size());
- xor_buf(&X[32], X.data(), &X[16], hash_block_size());
+ buffer_insert(m_X, 16, input, hash_block_size());
+ xor_buf(&m_X[32], m_X.data(), &m_X[16], hash_block_size());
byte T = 0;
for(size_t i = 0; i != 18; ++i)
{
for(size_t k = 0; k != 48; k += 8)
{
- T = X[k ] ^= SBOX[T]; T = X[k+1] ^= SBOX[T];
- T = X[k+2] ^= SBOX[T]; T = X[k+3] ^= SBOX[T];
- T = X[k+4] ^= SBOX[T]; T = X[k+5] ^= SBOX[T];
- T = X[k+6] ^= SBOX[T]; T = X[k+7] ^= SBOX[T];
+ T = m_X[k ] ^= SBOX[T]; T = m_X[k+1] ^= SBOX[T];
+ T = m_X[k+2] ^= SBOX[T]; T = m_X[k+3] ^= SBOX[T];
+ T = m_X[k+4] ^= SBOX[T]; T = m_X[k+5] ^= SBOX[T];
+ T = m_X[k+6] ^= SBOX[T]; T = m_X[k+7] ^= SBOX[T];
}
T += static_cast<byte>(i);
}
- T = checksum[15];
+ T = m_checksum[15];
for(size_t i = 0; i != hash_block_size(); ++i)
- T = checksum[i] ^= SBOX[input[i] ^ T];
+ T = m_checksum[i] ^= SBOX[input[i] ^ T];
}
/**
@@ -65,23 +65,23 @@ void MD2::hash(const byte input[])
*/
void MD2::add_data(const byte input[], size_t length)
{
- buffer_insert(buffer, position, input, length);
+ buffer_insert(m_buffer, m_position, input, length);
- if(position + length >= hash_block_size())
+ if(m_position + length >= hash_block_size())
{
- hash(buffer.data());
- input += (hash_block_size() - position);
- length -= (hash_block_size() - position);
+ hash(m_buffer.data());
+ input += (hash_block_size() - m_position);
+ length -= (hash_block_size() - m_position);
while(length >= hash_block_size())
{
hash(input);
input += hash_block_size();
length -= hash_block_size();
}
- copy_mem(buffer.data(), input, length);
- position = 0;
+ copy_mem(m_buffer.data(), input, length);
+ m_position = 0;
}
- position += length;
+ m_position += length;
}
/**
@@ -89,12 +89,12 @@ void MD2::add_data(const byte input[], size_t length)
*/
void MD2::final_result(byte output[])
{
- for(size_t i = position; i != hash_block_size(); ++i)
- buffer[i] = static_cast<byte>(hash_block_size() - position);
+ for(size_t i = m_position; i != hash_block_size(); ++i)
+ m_buffer[i] = static_cast<byte>(hash_block_size() - m_position);
- hash(buffer.data());
- hash(checksum.data());
- copy_mem(output, X.data(), output_length());
+ hash(m_buffer.data());
+ hash(m_checksum.data());
+ copy_mem(output, m_X.data(), output_length());
clear();
}
@@ -103,10 +103,10 @@ void MD2::final_result(byte output[])
*/
void MD2::clear()
{
- zeroise(X);
- zeroise(checksum);
- zeroise(buffer);
- position = 0;
+ zeroise(m_X);
+ zeroise(m_checksum);
+ zeroise(m_buffer);
+ m_position = 0;
}
}
diff --git a/src/lib/hash/md2/md2.h b/src/lib/hash/md2/md2.h
index 62f1b8a9f..8209d49d2 100644
--- a/src/lib/hash/md2/md2.h
+++ b/src/lib/hash/md2/md2.h
@@ -25,15 +25,15 @@ class BOTAN_DLL MD2 : public HashFunction
void clear() override;
- MD2() : X(48), checksum(16), buffer(16)
+ MD2() : m_X(48), m_checksum(16), m_buffer(16)
{ clear(); }
private:
void add_data(const byte[], size_t) override;
void hash(const byte[]);
void final_result(byte[]) override;
- secure_vector<byte> X, checksum, buffer;
- size_t position;
+ secure_vector<byte> m_X, m_checksum, m_buffer;
+ size_t m_position;
};
}
diff --git a/src/lib/hash/md4/md4.cpp b/src/lib/hash/md4/md4.cpp
index 6f4503ac0..d22f2d1ac 100644
--- a/src/lib/hash/md4/md4.cpp
+++ b/src/lib/hash/md4/md4.cpp
@@ -45,43 +45,43 @@ inline void HH(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit M, byte S)
*/
void MD4::compress_n(const byte input[], size_t blocks)
{
- u32bit A = digest[0], B = digest[1], C = digest[2], D = digest[3];
+ u32bit A = m_digest[0], B = m_digest[1], C = m_digest[2], D = m_digest[3];
for(size_t i = 0; i != blocks; ++i)
{
- load_le(M.data(), input, M.size());
-
- FF(A,B,C,D,M[ 0], 3); FF(D,A,B,C,M[ 1], 7);
- FF(C,D,A,B,M[ 2],11); FF(B,C,D,A,M[ 3],19);
- FF(A,B,C,D,M[ 4], 3); FF(D,A,B,C,M[ 5], 7);
- FF(C,D,A,B,M[ 6],11); FF(B,C,D,A,M[ 7],19);
- FF(A,B,C,D,M[ 8], 3); FF(D,A,B,C,M[ 9], 7);
- FF(C,D,A,B,M[10],11); FF(B,C,D,A,M[11],19);
- FF(A,B,C,D,M[12], 3); FF(D,A,B,C,M[13], 7);
- FF(C,D,A,B,M[14],11); FF(B,C,D,A,M[15],19);
-
- GG(A,B,C,D,M[ 0], 3); GG(D,A,B,C,M[ 4], 5);
- GG(C,D,A,B,M[ 8], 9); GG(B,C,D,A,M[12],13);
- GG(A,B,C,D,M[ 1], 3); GG(D,A,B,C,M[ 5], 5);
- GG(C,D,A,B,M[ 9], 9); GG(B,C,D,A,M[13],13);
- GG(A,B,C,D,M[ 2], 3); GG(D,A,B,C,M[ 6], 5);
- GG(C,D,A,B,M[10], 9); GG(B,C,D,A,M[14],13);
- GG(A,B,C,D,M[ 3], 3); GG(D,A,B,C,M[ 7], 5);
- GG(C,D,A,B,M[11], 9); GG(B,C,D,A,M[15],13);
-
- HH(A,B,C,D,M[ 0], 3); HH(D,A,B,C,M[ 8], 9);
- HH(C,D,A,B,M[ 4],11); HH(B,C,D,A,M[12],15);
- HH(A,B,C,D,M[ 2], 3); HH(D,A,B,C,M[10], 9);
- HH(C,D,A,B,M[ 6],11); HH(B,C,D,A,M[14],15);
- HH(A,B,C,D,M[ 1], 3); HH(D,A,B,C,M[ 9], 9);
- HH(C,D,A,B,M[ 5],11); HH(B,C,D,A,M[13],15);
- HH(A,B,C,D,M[ 3], 3); HH(D,A,B,C,M[11], 9);
- HH(C,D,A,B,M[ 7],11); HH(B,C,D,A,M[15],15);
-
- A = (digest[0] += A);
- B = (digest[1] += B);
- C = (digest[2] += C);
- D = (digest[3] += D);
+ load_le(m_M.data(), input, m_M.size());
+
+ FF(A,B,C,D,m_M[ 0], 3); FF(D,A,B,C,m_M[ 1], 7);
+ FF(C,D,A,B,m_M[ 2],11); FF(B,C,D,A,m_M[ 3],19);
+ FF(A,B,C,D,m_M[ 4], 3); FF(D,A,B,C,m_M[ 5], 7);
+ FF(C,D,A,B,m_M[ 6],11); FF(B,C,D,A,m_M[ 7],19);
+ FF(A,B,C,D,m_M[ 8], 3); FF(D,A,B,C,m_M[ 9], 7);
+ FF(C,D,A,B,m_M[10],11); FF(B,C,D,A,m_M[11],19);
+ FF(A,B,C,D,m_M[12], 3); FF(D,A,B,C,m_M[13], 7);
+ FF(C,D,A,B,m_M[14],11); FF(B,C,D,A,m_M[15],19);
+
+ GG(A,B,C,D,m_M[ 0], 3); GG(D,A,B,C,m_M[ 4], 5);
+ GG(C,D,A,B,m_M[ 8], 9); GG(B,C,D,A,m_M[12],13);
+ GG(A,B,C,D,m_M[ 1], 3); GG(D,A,B,C,m_M[ 5], 5);
+ GG(C,D,A,B,m_M[ 9], 9); GG(B,C,D,A,m_M[13],13);
+ GG(A,B,C,D,m_M[ 2], 3); GG(D,A,B,C,m_M[ 6], 5);
+ GG(C,D,A,B,m_M[10], 9); GG(B,C,D,A,m_M[14],13);
+ GG(A,B,C,D,m_M[ 3], 3); GG(D,A,B,C,m_M[ 7], 5);
+ GG(C,D,A,B,m_M[11], 9); GG(B,C,D,A,m_M[15],13);
+
+ HH(A,B,C,D,m_M[ 0], 3); HH(D,A,B,C,m_M[ 8], 9);
+ HH(C,D,A,B,m_M[ 4],11); HH(B,C,D,A,m_M[12],15);
+ HH(A,B,C,D,m_M[ 2], 3); HH(D,A,B,C,m_M[10], 9);
+ HH(C,D,A,B,m_M[ 6],11); HH(B,C,D,A,m_M[14],15);
+ HH(A,B,C,D,m_M[ 1], 3); HH(D,A,B,C,m_M[ 9], 9);
+ HH(C,D,A,B,m_M[ 5],11); HH(B,C,D,A,m_M[13],15);
+ HH(A,B,C,D,m_M[ 3], 3); HH(D,A,B,C,m_M[11], 9);
+ HH(C,D,A,B,m_M[ 7],11); HH(B,C,D,A,m_M[15],15);
+
+ A = (m_digest[0] += A);
+ B = (m_digest[1] += B);
+ C = (m_digest[2] += C);
+ D = (m_digest[3] += D);
input += hash_block_size();
}
@@ -92,7 +92,7 @@ void MD4::compress_n(const byte input[], size_t blocks)
*/
void MD4::copy_out(byte output[])
{
- copy_out_vec_le(output, output_length(), digest);
+ copy_out_vec_le(output, output_length(), m_digest);
}
/*
@@ -101,11 +101,11 @@ void MD4::copy_out(byte output[])
void MD4::clear()
{
MDx_HashFunction::clear();
- zeroise(M);
- digest[0] = 0x67452301;
- digest[1] = 0xEFCDAB89;
- digest[2] = 0x98BADCFE;
- digest[3] = 0x10325476;
+ zeroise(m_M);
+ m_digest[0] = 0x67452301;
+ m_digest[1] = 0xEFCDAB89;
+ m_digest[2] = 0x98BADCFE;
+ m_digest[3] = 0x10325476;
}
}
diff --git a/src/lib/hash/md4/md4.h b/src/lib/hash/md4/md4.h
index 182da4ab2..a0e481773 100644
--- a/src/lib/hash/md4/md4.h
+++ b/src/lib/hash/md4/md4.h
@@ -24,7 +24,7 @@ class BOTAN_DLL MD4 : public MDx_HashFunction
void clear() override;
- MD4() : MDx_HashFunction(64, false, true), M(16), digest(4)
+ MD4() : MDx_HashFunction(64, false, true), m_M(16), m_digest(4)
{ clear(); }
protected:
void compress_n(const byte input[], size_t blocks) override;
@@ -33,12 +33,12 @@ class BOTAN_DLL MD4 : public MDx_HashFunction
/**
* The message buffer, exposed for use by subclasses (x86 asm)
*/
- secure_vector<u32bit> M;
+ secure_vector<u32bit> m_M;
/**
* The digest value, exposed for use by subclasses (x86 asm)
*/
- secure_vector<u32bit> digest;
+ secure_vector<u32bit> m_digest;
};
}
diff --git a/src/lib/hash/md5/md5.cpp b/src/lib/hash/md5/md5.cpp
index 89ca52419..439dbde7b 100644
--- a/src/lib/hash/md5/md5.cpp
+++ b/src/lib/hash/md5/md5.cpp
@@ -58,52 +58,52 @@ inline void II(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg,
*/
void MD5::compress_n(const byte input[], size_t blocks)
{
- u32bit A = digest[0], B = digest[1], C = digest[2], D = digest[3];
+ u32bit A = m_digest[0], B = m_digest[1], C = m_digest[2], D = m_digest[3];
for(size_t i = 0; i != blocks; ++i)
{
- load_le(M.data(), input, M.size());
-
- FF(A,B,C,D,M[ 0], 7,0xD76AA478); FF(D,A,B,C,M[ 1],12,0xE8C7B756);
- FF(C,D,A,B,M[ 2],17,0x242070DB); FF(B,C,D,A,M[ 3],22,0xC1BDCEEE);
- FF(A,B,C,D,M[ 4], 7,0xF57C0FAF); FF(D,A,B,C,M[ 5],12,0x4787C62A);
- FF(C,D,A,B,M[ 6],17,0xA8304613); FF(B,C,D,A,M[ 7],22,0xFD469501);
- FF(A,B,C,D,M[ 8], 7,0x698098D8); FF(D,A,B,C,M[ 9],12,0x8B44F7AF);
- FF(C,D,A,B,M[10],17,0xFFFF5BB1); FF(B,C,D,A,M[11],22,0x895CD7BE);
- FF(A,B,C,D,M[12], 7,0x6B901122); FF(D,A,B,C,M[13],12,0xFD987193);
- FF(C,D,A,B,M[14],17,0xA679438E); FF(B,C,D,A,M[15],22,0x49B40821);
-
- GG(A,B,C,D,M[ 1], 5,0xF61E2562); GG(D,A,B,C,M[ 6], 9,0xC040B340);
- GG(C,D,A,B,M[11],14,0x265E5A51); GG(B,C,D,A,M[ 0],20,0xE9B6C7AA);
- GG(A,B,C,D,M[ 5], 5,0xD62F105D); GG(D,A,B,C,M[10], 9,0x02441453);
- GG(C,D,A,B,M[15],14,0xD8A1E681); GG(B,C,D,A,M[ 4],20,0xE7D3FBC8);
- GG(A,B,C,D,M[ 9], 5,0x21E1CDE6); GG(D,A,B,C,M[14], 9,0xC33707D6);
- GG(C,D,A,B,M[ 3],14,0xF4D50D87); GG(B,C,D,A,M[ 8],20,0x455A14ED);
- GG(A,B,C,D,M[13], 5,0xA9E3E905); GG(D,A,B,C,M[ 2], 9,0xFCEFA3F8);
- GG(C,D,A,B,M[ 7],14,0x676F02D9); GG(B,C,D,A,M[12],20,0x8D2A4C8A);
-
- HH(A,B,C,D,M[ 5], 4,0xFFFA3942); HH(D,A,B,C,M[ 8],11,0x8771F681);
- HH(C,D,A,B,M[11],16,0x6D9D6122); HH(B,C,D,A,M[14],23,0xFDE5380C);
- HH(A,B,C,D,M[ 1], 4,0xA4BEEA44); HH(D,A,B,C,M[ 4],11,0x4BDECFA9);
- HH(C,D,A,B,M[ 7],16,0xF6BB4B60); HH(B,C,D,A,M[10],23,0xBEBFBC70);
- HH(A,B,C,D,M[13], 4,0x289B7EC6); HH(D,A,B,C,M[ 0],11,0xEAA127FA);
- HH(C,D,A,B,M[ 3],16,0xD4EF3085); HH(B,C,D,A,M[ 6],23,0x04881D05);
- HH(A,B,C,D,M[ 9], 4,0xD9D4D039); HH(D,A,B,C,M[12],11,0xE6DB99E5);
- HH(C,D,A,B,M[15],16,0x1FA27CF8); HH(B,C,D,A,M[ 2],23,0xC4AC5665);
-
- II(A,B,C,D,M[ 0], 6,0xF4292244); II(D,A,B,C,M[ 7],10,0x432AFF97);
- II(C,D,A,B,M[14],15,0xAB9423A7); II(B,C,D,A,M[ 5],21,0xFC93A039);
- II(A,B,C,D,M[12], 6,0x655B59C3); II(D,A,B,C,M[ 3],10,0x8F0CCC92);
- II(C,D,A,B,M[10],15,0xFFEFF47D); II(B,C,D,A,M[ 1],21,0x85845DD1);
- II(A,B,C,D,M[ 8], 6,0x6FA87E4F); II(D,A,B,C,M[15],10,0xFE2CE6E0);
- II(C,D,A,B,M[ 6],15,0xA3014314); II(B,C,D,A,M[13],21,0x4E0811A1);
- II(A,B,C,D,M[ 4], 6,0xF7537E82); II(D,A,B,C,M[11],10,0xBD3AF235);
- II(C,D,A,B,M[ 2],15,0x2AD7D2BB); II(B,C,D,A,M[ 9],21,0xEB86D391);
-
- A = (digest[0] += A);
- B = (digest[1] += B);
- C = (digest[2] += C);
- D = (digest[3] += D);
+ load_le(m_M.data(), input, m_M.size());
+
+ FF(A,B,C,D,m_M[ 0], 7,0xD76AA478); FF(D,A,B,C,m_M[ 1],12,0xE8C7B756);
+ FF(C,D,A,B,m_M[ 2],17,0x242070DB); FF(B,C,D,A,m_M[ 3],22,0xC1BDCEEE);
+ FF(A,B,C,D,m_M[ 4], 7,0xF57C0FAF); FF(D,A,B,C,m_M[ 5],12,0x4787C62A);
+ FF(C,D,A,B,m_M[ 6],17,0xA8304613); FF(B,C,D,A,m_M[ 7],22,0xFD469501);
+ FF(A,B,C,D,m_M[ 8], 7,0x698098D8); FF(D,A,B,C,m_M[ 9],12,0x8B44F7AF);
+ FF(C,D,A,B,m_M[10],17,0xFFFF5BB1); FF(B,C,D,A,m_M[11],22,0x895CD7BE);
+ FF(A,B,C,D,m_M[12], 7,0x6B901122); FF(D,A,B,C,m_M[13],12,0xFD987193);
+ FF(C,D,A,B,m_M[14],17,0xA679438E); FF(B,C,D,A,m_M[15],22,0x49B40821);
+
+ GG(A,B,C,D,m_M[ 1], 5,0xF61E2562); GG(D,A,B,C,m_M[ 6], 9,0xC040B340);
+ GG(C,D,A,B,m_M[11],14,0x265E5A51); GG(B,C,D,A,m_M[ 0],20,0xE9B6C7AA);
+ GG(A,B,C,D,m_M[ 5], 5,0xD62F105D); GG(D,A,B,C,m_M[10], 9,0x02441453);
+ GG(C,D,A,B,m_M[15],14,0xD8A1E681); GG(B,C,D,A,m_M[ 4],20,0xE7D3FBC8);
+ GG(A,B,C,D,m_M[ 9], 5,0x21E1CDE6); GG(D,A,B,C,m_M[14], 9,0xC33707D6);
+ GG(C,D,A,B,m_M[ 3],14,0xF4D50D87); GG(B,C,D,A,m_M[ 8],20,0x455A14ED);
+ GG(A,B,C,D,m_M[13], 5,0xA9E3E905); GG(D,A,B,C,m_M[ 2], 9,0xFCEFA3F8);
+ GG(C,D,A,B,m_M[ 7],14,0x676F02D9); GG(B,C,D,A,m_M[12],20,0x8D2A4C8A);
+
+ HH(A,B,C,D,m_M[ 5], 4,0xFFFA3942); HH(D,A,B,C,m_M[ 8],11,0x8771F681);
+ HH(C,D,A,B,m_M[11],16,0x6D9D6122); HH(B,C,D,A,m_M[14],23,0xFDE5380C);
+ HH(A,B,C,D,m_M[ 1], 4,0xA4BEEA44); HH(D,A,B,C,m_M[ 4],11,0x4BDECFA9);
+ HH(C,D,A,B,m_M[ 7],16,0xF6BB4B60); HH(B,C,D,A,m_M[10],23,0xBEBFBC70);
+ HH(A,B,C,D,m_M[13], 4,0x289B7EC6); HH(D,A,B,C,m_M[ 0],11,0xEAA127FA);
+ HH(C,D,A,B,m_M[ 3],16,0xD4EF3085); HH(B,C,D,A,m_M[ 6],23,0x04881D05);
+ HH(A,B,C,D,m_M[ 9], 4,0xD9D4D039); HH(D,A,B,C,m_M[12],11,0xE6DB99E5);
+ HH(C,D,A,B,m_M[15],16,0x1FA27CF8); HH(B,C,D,A,m_M[ 2],23,0xC4AC5665);
+
+ II(A,B,C,D,m_M[ 0], 6,0xF4292244); II(D,A,B,C,m_M[ 7],10,0x432AFF97);
+ II(C,D,A,B,m_M[14],15,0xAB9423A7); II(B,C,D,A,m_M[ 5],21,0xFC93A039);
+ II(A,B,C,D,m_M[12], 6,0x655B59C3); II(D,A,B,C,m_M[ 3],10,0x8F0CCC92);
+ II(C,D,A,B,m_M[10],15,0xFFEFF47D); II(B,C,D,A,m_M[ 1],21,0x85845DD1);
+ II(A,B,C,D,m_M[ 8], 6,0x6FA87E4F); II(D,A,B,C,m_M[15],10,0xFE2CE6E0);
+ II(C,D,A,B,m_M[ 6],15,0xA3014314); II(B,C,D,A,m_M[13],21,0x4E0811A1);
+ II(A,B,C,D,m_M[ 4], 6,0xF7537E82); II(D,A,B,C,m_M[11],10,0xBD3AF235);
+ II(C,D,A,B,m_M[ 2],15,0x2AD7D2BB); II(B,C,D,A,m_M[ 9],21,0xEB86D391);
+
+ A = (m_digest[0] += A);
+ B = (m_digest[1] += B);
+ C = (m_digest[2] += C);
+ D = (m_digest[3] += D);
input += hash_block_size();
}
@@ -114,7 +114,7 @@ void MD5::compress_n(const byte input[], size_t blocks)
*/
void MD5::copy_out(byte output[])
{
- copy_out_vec_le(output, output_length(), digest);
+ copy_out_vec_le(output, output_length(), m_digest);
}
/*
@@ -123,11 +123,11 @@ void MD5::copy_out(byte output[])
void MD5::clear()
{
MDx_HashFunction::clear();
- zeroise(M);
- digest[0] = 0x67452301;
- digest[1] = 0xEFCDAB89;
- digest[2] = 0x98BADCFE;
- digest[3] = 0x10325476;
+ zeroise(m_M);
+ m_digest[0] = 0x67452301;
+ m_digest[1] = 0xEFCDAB89;
+ m_digest[2] = 0x98BADCFE;
+ m_digest[3] = 0x10325476;
}
}
diff --git a/src/lib/hash/md5/md5.h b/src/lib/hash/md5/md5.h
index 9c5e548c0..b0465c838 100644
--- a/src/lib/hash/md5/md5.h
+++ b/src/lib/hash/md5/md5.h
@@ -24,7 +24,7 @@ class BOTAN_DLL MD5 : public MDx_HashFunction
void clear() override;
- MD5() : MDx_HashFunction(64, false, true), M(16), digest(4)
+ MD5() : MDx_HashFunction(64, false, true), m_M(16), m_digest(4)
{ clear(); }
protected:
void compress_n(const byte[], size_t blocks) override;
@@ -33,12 +33,12 @@ class BOTAN_DLL MD5 : public MDx_HashFunction
/**
* The message buffer, exposed for use by subclasses (x86 asm)
*/
- secure_vector<u32bit> M;
+ secure_vector<u32bit> m_M;
/**
* The digest value, exposed for use by subclasses (x86 asm)
*/
- secure_vector<u32bit> digest;
+ secure_vector<u32bit> m_digest;
};
}
diff --git a/src/lib/hash/mdx_hash/mdx_hash.cpp b/src/lib/hash/mdx_hash/mdx_hash.cpp
index bd754d3cc..f21b4ac34 100644
--- a/src/lib/hash/mdx_hash/mdx_hash.cpp
+++ b/src/lib/hash/mdx_hash/mdx_hash.cpp
@@ -18,12 +18,12 @@ MDx_HashFunction::MDx_HashFunction(size_t block_len,
bool byte_end,
bool bit_end,
size_t cnt_size) :
- buffer(block_len),
+ m_buffer(block_len),
BIG_BYTE_ENDIAN(byte_end),
BIG_BIT_ENDIAN(bit_end),
COUNT_SIZE(cnt_size)
{
- count = position = 0;
+ m_count = m_position = 0;
}
/*
@@ -31,8 +31,8 @@ MDx_HashFunction::MDx_HashFunction(size_t block_len,
*/
void MDx_HashFunction::clear()
{
- zeroise(buffer);
- count = position = 0;
+ zeroise(m_buffer);
+ m_count = m_position = 0;
}
/*
@@ -40,29 +40,29 @@ void MDx_HashFunction::clear()
*/
void MDx_HashFunction::add_data(const byte input[], size_t length)
{
- count += length;
+ m_count += length;
- if(position)
+ if(m_position)
{
- buffer_insert(buffer, position, input, length);
+ buffer_insert(m_buffer, m_position, input, length);
- if(position + length >= buffer.size())
+ if(m_position + length >= m_buffer.size())
{
- compress_n(buffer.data(), 1);
- input += (buffer.size() - position);
- length -= (buffer.size() - position);
- position = 0;
+ compress_n(m_buffer.data(), 1);
+ input += (m_buffer.size() - m_position);
+ length -= (m_buffer.size() - m_position);
+ m_position = 0;
}
}
- const size_t full_blocks = length / buffer.size();
- const size_t remaining = length % buffer.size();
+ const size_t full_blocks = length / m_buffer.size();
+ const size_t remaining = length % m_buffer.size();
if(full_blocks)
compress_n(input, full_blocks);
- buffer_insert(buffer, position, input + full_blocks * buffer.size(), remaining);
- position += remaining;
+ buffer_insert(m_buffer, m_position, input + full_blocks * m_buffer.size(), remaining);
+ m_position += remaining;
}
/*
@@ -70,19 +70,19 @@ void MDx_HashFunction::add_data(const byte input[], size_t length)
*/
void MDx_HashFunction::final_result(byte output[])
{
- buffer[position] = (BIG_BIT_ENDIAN ? 0x80 : 0x01);
- for(size_t i = position+1; i != buffer.size(); ++i)
- buffer[i] = 0;
+ 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(position >= buffer.size() - COUNT_SIZE)
+ if(m_position >= m_buffer.size() - COUNT_SIZE)
{
- compress_n(buffer.data(), 1);
- zeroise(buffer);
+ compress_n(m_buffer.data(), 1);
+ zeroise(m_buffer);
}
- write_count(&buffer[buffer.size() - COUNT_SIZE]);
+ write_count(&m_buffer[m_buffer.size() - COUNT_SIZE]);
- compress_n(buffer.data(), 1);
+ compress_n(m_buffer.data(), 1);
copy_out(output);
clear();
}
@@ -97,7 +97,7 @@ void MDx_HashFunction::write_count(byte out[])
if(COUNT_SIZE >= output_length() || COUNT_SIZE >= hash_block_size())
throw Invalid_Argument("MDx_HashFunction: COUNT_SIZE is too big");
- const u64bit bit_count = count * 8;
+ const u64bit bit_count = m_count * 8;
if(BIG_BYTE_ENDIAN)
store_be(bit_count, out + COUNT_SIZE - 8);
diff --git a/src/lib/hash/mdx_hash/mdx_hash.h b/src/lib/hash/mdx_hash/mdx_hash.h
index 2652d9ea6..4b2f9bad0 100644
--- a/src/lib/hash/mdx_hash/mdx_hash.h
+++ b/src/lib/hash/mdx_hash/mdx_hash.h
@@ -29,7 +29,7 @@ class BOTAN_DLL MDx_HashFunction : public HashFunction
bool big_bit_endian,
size_t counter_size = 8);
- size_t hash_block_size() const override { return buffer.size(); }
+ size_t hash_block_size() const override { return m_buffer.size(); }
protected:
void add_data(const byte input[], size_t length) override;
void final_result(byte output[]) override;
@@ -55,9 +55,9 @@ class BOTAN_DLL MDx_HashFunction : public HashFunction
*/
virtual void write_count(byte out[]);
private:
- secure_vector<byte> buffer;
- u64bit count;
- size_t position;
+ secure_vector<byte> m_buffer;
+ u64bit m_count;
+ size_t m_position;
const bool BIG_BYTE_ENDIAN, BIG_BIT_ENDIAN;
const size_t COUNT_SIZE;
diff --git a/src/lib/hash/par_hash/par_hash.cpp b/src/lib/hash/par_hash/par_hash.cpp
index 5e970ab13..5645a99c7 100644
--- a/src/lib/hash/par_hash/par_hash.cpp
+++ b/src/lib/hash/par_hash/par_hash.cpp
@@ -12,24 +12,24 @@ namespace Botan {
Parallel* Parallel::make(const Spec& spec)
{
- std::vector<std::unique_ptr<HashFunction>> hashes;
+ std::vector<std::unique_ptr<HashFunction>> m_hashes;
for(size_t i = 0; i != spec.arg_count(); ++i)
{
auto h = HashFunction::create(spec.arg(i));
if(!h)
return nullptr;
- hashes.push_back(std::move(h));
+ m_hashes.push_back(std::move(h));
}
Parallel* p = new Parallel;
- std::swap(p->hashes, hashes);
+ std::swap(p->m_hashes, m_hashes);
return p;
}
void Parallel::add_data(const byte input[], size_t length)
{
- for(auto&& hash : hashes)
+ for(auto&& hash : m_hashes)
hash->update(input, length);
}
@@ -37,7 +37,7 @@ void Parallel::final_result(byte out[])
{
u32bit offset = 0;
- for(auto&& hash : hashes)
+ for(auto&& hash : m_hashes)
{
hash->final(out + offset);
offset += hash->output_length();
@@ -48,7 +48,7 @@ size_t Parallel::output_length() const
{
size_t sum = 0;
- for(auto&& hash : hashes)
+ for(auto&& hash : m_hashes)
sum += hash->output_length();
return sum;
}
@@ -57,7 +57,7 @@ std::string Parallel::name() const
{
std::vector<std::string> names;
- for(auto&& hash : hashes)
+ for(auto&& hash : m_hashes)
names.push_back(hash->name());
return "Parallel(" + string_join(names, ',') + ")";
@@ -67,7 +67,7 @@ HashFunction* Parallel::clone() const
{
std::vector<HashFunction*> hash_copies;
- for(auto&& hash : hashes)
+ for(auto&& hash : m_hashes)
hash_copies.push_back(hash->clone());
return new Parallel(hash_copies);
@@ -75,7 +75,7 @@ HashFunction* Parallel::clone() const
void Parallel::clear()
{
- for(auto&& hash : hashes)
+ for(auto&& hash : m_hashes)
hash->clear();
}
@@ -84,7 +84,7 @@ Parallel::Parallel(const std::vector<HashFunction*>& in)
for(size_t i = 0; i != in.size(); ++i)
{
std::unique_ptr<HashFunction> h(in[i]->clone());
- hashes.push_back(std::move(h));
+ m_hashes.push_back(std::move(h));
}
}
diff --git a/src/lib/hash/par_hash/par_hash.h b/src/lib/hash/par_hash/par_hash.h
index 0410e6826..432fed466 100644
--- a/src/lib/hash/par_hash/par_hash.h
+++ b/src/lib/hash/par_hash/par_hash.h
@@ -40,7 +40,7 @@ class BOTAN_DLL Parallel : public HashFunction
void add_data(const byte[], size_t) override;
void final_result(byte[]) override;
- std::vector<std::unique_ptr<HashFunction>> hashes;
+ std::vector<std::unique_ptr<HashFunction>> m_hashes;
};
}
diff --git a/src/lib/hash/rmd128/rmd128.cpp b/src/lib/hash/rmd128/rmd128.cpp
index 394bf2acf..e520fa0c3 100644
--- a/src/lib/hash/rmd128/rmd128.cpp
+++ b/src/lib/hash/rmd128/rmd128.cpp
@@ -66,84 +66,84 @@ void RIPEMD_128::compress_n(const byte input[], size_t blocks)
for(size_t i = 0; i != blocks; ++i)
{
- load_le(M.data(), input, M.size());
-
- u32bit A1 = digest[0], A2 = A1, B1 = digest[1], B2 = B1,
- C1 = digest[2], C2 = C1, D1 =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2,B2,C2,M[11],13,MAGIC6);
- F2(C1,D1,A1,B1,M[13], 8,MAGIC2); F3(C2,D2,A2,B2,M[ 3],15,MAGIC6);
- F2(B1,C1,D1,A1,M[ 1],13,MAGIC2); F3(B2,C2,D2,A2,M[ 7], 7,MAGIC6);
- F2(A1,B1,C1,D1,M[10],11,MAGIC2); F3(A2,B2,C2,D2,M[ 0],12,MAGIC6);
- F2(D1,A1,B1,C1,M[ 6], 9,MAGIC2); F3(D2,A2,B2,C2,M[13], 8,MAGIC6);
- F2(C1,D1,A1,B1,M[15], 7,MAGIC2); F3(C2,D2,A2,B2,M[ 5], 9,MAGIC6);
- F2(B1,C1,D1,A1,M[ 3],15,MAGIC2); F3(B2,C2,D2,A2,M[10],11,MAGIC6);
- F2(A1,B1,C1,D1,M[12], 7,MAGIC2); F3(A2,B2,C2,D2,M[14], 7,MAGIC6);
- F2(D1,A1,B1,C1,M[ 0],12,MAGIC2); F3(D2,A2,B2,C2,M[15], 7,MAGIC6);
- F2(C1,D1,A1,B1,M[ 9],15,MAGIC2); F3(C2,D2,A2,B2,M[ 8],12,MAGIC6);
- F2(B1,C1,D1,A1,M[ 5], 9,MAGIC2); F3(B2,C2,D2,A2,M[12], 7,MAGIC6);
- F2(A1,B1,C1,D1,M[ 2],11,MAGIC2); F3(A2,B2,C2,D2,M[ 4], 6,MAGIC6);
- F2(D1,A1,B1,C1,M[14], 7,MAGIC2); F3(D2,A2,B2,C2,M[ 9],15,MAGIC6);
- F2(C1,D1,A1,B1,M[11],13,MAGIC2); F3(C2,D2,A2,B2,M[ 1],13,MAGIC6);
- F2(B1,C1,D1,A1,M[ 8],12,MAGIC2); F3(B2,C2,D2,A2,M[ 2],11,MAGIC6);
-
- F3(A1,B1,C1,D1,M[ 3],11,MAGIC3); F2(A2,B2,C2,D2,M[15], 9,MAGIC7);
- F3(D1,A1,B1,C1,M[10],13,MAGIC3); F2(D2,A2,B2,C2,M[ 5], 7,MAGIC7);
- F3(C1,D1,A1,B1,M[14], 6,MAGIC3); F2(C2,D2,A2,B2,M[ 1],15,MAGIC7);
- F3(B1,C1,D1,A1,M[ 4], 7,MAGIC3); F2(B2,C2,D2,A2,M[ 3],11,MAGIC7);
- F3(A1,B1,C1,D1,M[ 9],14,MAGIC3); F2(A2,B2,C2,D2,M[ 7], 8,MAGIC7);
- F3(D1,A1,B1,C1,M[15], 9,MAGIC3); F2(D2,A2,B2,C2,M[14], 6,MAGIC7);
- F3(C1,D1,A1,B1,M[ 8],13,MAGIC3); F2(C2,D2,A2,B2,M[ 6], 6,MAGIC7);
- F3(B1,C1,D1,A1,M[ 1],15,MAGIC3); F2(B2,C2,D2,A2,M[ 9],14,MAGIC7);
- F3(A1,B1,C1,D1,M[ 2],14,MAGIC3); F2(A2,B2,C2,D2,M[11],12,MAGIC7);
- F3(D1,A1,B1,C1,M[ 7], 8,MAGIC3); F2(D2,A2,B2,C2,M[ 8],13,MAGIC7);
- F3(C1,D1,A1,B1,M[ 0],13,MAGIC3); F2(C2,D2,A2,B2,M[12], 5,MAGIC7);
- F3(B1,C1,D1,A1,M[ 6], 6,MAGIC3); F2(B2,C2,D2,A2,M[ 2],14,MAGIC7);
- F3(A1,B1,C1,D1,M[13], 5,MAGIC3); F2(A2,B2,C2,D2,M[10],13,MAGIC7);
- F3(D1,A1,B1,C1,M[11],12,MAGIC3); F2(D2,A2,B2,C2,M[ 0],13,MAGIC7);
- F3(C1,D1,A1,B1,M[ 5], 7,MAGIC3); F2(C2,D2,A2,B2,M[ 4], 7,MAGIC7);
- F3(B1,C1,D1,A1,M[12], 5,MAGIC3); F2(B2,C2,D2,A2,M[13], 5,MAGIC7);
-
- F4(A1,B1,C1,D1,M[ 1],11,MAGIC4); F1(A2,B2,C2,D2,M[ 8],15 );
- F4(D1,A1,B1,C1,M[ 9],12,MAGIC4); F1(D2,A2,B2,C2,M[ 6], 5 );
- F4(C1,D1,A1,B1,M[11],14,MAGIC4); F1(C2,D2,A2,B2,M[ 4], 8 );
- F4(B1,C1,D1,A1,M[10],15,MAGIC4); F1(B2,C2,D2,A2,M[ 1],11 );
- F4(A1,B1,C1,D1,M[ 0],14,MAGIC4); F1(A2,B2,C2,D2,M[ 3],14 );
- F4(D1,A1,B1,C1,M[ 8],15,MAGIC4); F1(D2,A2,B2,C2,M[11],14 );
- F4(C1,D1,A1,B1,M[12], 9,MAGIC4); F1(C2,D2,A2,B2,M[15], 6 );
- F4(B1,C1,D1,A1,M[ 4], 8,MAGIC4); F1(B2,C2,D2,A2,M[ 0],14 );
- F4(A1,B1,C1,D1,M[13], 9,MAGIC4); F1(A2,B2,C2,D2,M[ 5], 6 );
- F4(D1,A1,B1,C1,M[ 3],14,MAGIC4); F1(D2,A2,B2,C2,M[12], 9 );
- F4(C1,D1,A1,B1,M[ 7], 5,MAGIC4); F1(C2,D2,A2,B2,M[ 2],12 );
- F4(B1,C1,D1,A1,M[15], 6,MAGIC4); F1(B2,C2,D2,A2,M[13], 9 );
- F4(A1,B1,C1,D1,M[14], 8,MAGIC4); F1(A2,B2,C2,D2,M[ 9],12 );
- F4(D1,A1,B1,C1,M[ 5], 6,MAGIC4); F1(D2,A2,B2,C2,M[ 7], 5 );
- F4(C1,D1,A1,B1,M[ 6], 5,MAGIC4); F1(C2,D2,A2,B2,M[10],15 );
- F4(B1,C1,D1,A1,M[ 2],12,MAGIC4); F1(B2,C2,D2,A2,M[14], 8 );
-
- D2 = digest[1] + C1 + D2;
- digest[1] = digest[2] + D1 + A2;
- digest[2] = digest[3] + A1 + B2;
- digest[3] = digest[0] + B1 + C2;
- digest[0] = D2;
+ load_le(m_M.data(), input, m_M.size());
+
+ u32bit A1 = m_digest[0], A2 = A1, B1 = m_digest[1], B2 = B1,
+ C1 = m_digest[2], C2 = C1, D1 = m_digest[3], D2 = D1;
+
+ F1(A1,B1,C1,D1,m_M[ 0],11 ); F4(A2,B2,C2,D2,m_M[ 5], 8,MAGIC5);
+ F1(D1,A1,B1,C1,m_M[ 1],14 ); F4(D2,A2,B2,C2,m_M[14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D1,A1,B1,C1,m_M[ 9],12,MAGIC4); F1(D2,A2,B2,C2,m_M[ 6], 5 );
+ F4(C1,D1,A1,B1,m_M[11],14,MAGIC4); F1(C2,D2,A2,B2,m_M[ 4], 8 );
+ F4(B1,C1,D1,A1,m_M[10],15,MAGIC4); F1(B2,C2,D2,A2,m_M[ 1],11 );
+ F4(A1,B1,C1,D1,m_M[ 0],14,MAGIC4); F1(A2,B2,C2,D2,m_M[ 3],14 );
+ F4(D1,A1,B1,C1,m_M[ 8],15,MAGIC4); F1(D2,A2,B2,C2,m_M[11],14 );
+ F4(C1,D1,A1,B1,m_M[12], 9,MAGIC4); F1(C2,D2,A2,B2,m_M[15], 6 );
+ F4(B1,C1,D1,A1,m_M[ 4], 8,MAGIC4); F1(B2,C2,D2,A2,m_M[ 0],14 );
+ F4(A1,B1,C1,D1,m_M[13], 9,MAGIC4); F1(A2,B2,C2,D2,m_M[ 5], 6 );
+ F4(D1,A1,B1,C1,m_M[ 3],14,MAGIC4); F1(D2,A2,B2,C2,m_M[12], 9 );
+ F4(C1,D1,A1,B1,m_M[ 7], 5,MAGIC4); F1(C2,D2,A2,B2,m_M[ 2],12 );
+ F4(B1,C1,D1,A1,m_M[15], 6,MAGIC4); F1(B2,C2,D2,A2,m_M[13], 9 );
+ F4(A1,B1,C1,D1,m_M[14], 8,MAGIC4); F1(A2,B2,C2,D2,m_M[ 9],12 );
+ F4(D1,A1,B1,C1,m_M[ 5], 6,MAGIC4); F1(D2,A2,B2,C2,m_M[ 7], 5 );
+ F4(C1,D1,A1,B1,m_M[ 6], 5,MAGIC4); F1(C2,D2,A2,B2,m_M[10],15 );
+ F4(B1,C1,D1,A1,m_M[ 2],12,MAGIC4); F1(B2,C2,D2,A2,m_M[14], 8 );
+
+ D2 = m_digest[1] + C1 + D2;
+ m_digest[1] = m_digest[2] + D1 + A2;
+ m_digest[2] = m_digest[3] + A1 + B2;
+ m_digest[3] = m_digest[0] + B1 + C2;
+ m_digest[0] = D2;
input += hash_block_size();
}
@@ -154,7 +154,7 @@ void RIPEMD_128::compress_n(const byte input[], size_t blocks)
*/
void RIPEMD_128::copy_out(byte output[])
{
- copy_out_vec_le(output, output_length(), digest);
+ copy_out_vec_le(output, output_length(), m_digest);
}
/*
@@ -163,11 +163,11 @@ void RIPEMD_128::copy_out(byte output[])
void RIPEMD_128::clear()
{
MDx_HashFunction::clear();
- zeroise(M);
- digest[0] = 0x67452301;
- digest[1] = 0xEFCDAB89;
- digest[2] = 0x98BADCFE;
- digest[3] = 0x10325476;
+ zeroise(m_M);
+ m_digest[0] = 0x67452301;
+ m_digest[1] = 0xEFCDAB89;
+ m_digest[2] = 0x98BADCFE;
+ m_digest[3] = 0x10325476;
}
}
diff --git a/src/lib/hash/rmd128/rmd128.h b/src/lib/hash/rmd128/rmd128.h
index ea1eb2286..e4ef551ea 100644
--- a/src/lib/hash/rmd128/rmd128.h
+++ b/src/lib/hash/rmd128/rmd128.h
@@ -24,13 +24,13 @@ class BOTAN_DLL RIPEMD_128 : public MDx_HashFunction
void clear() override;
- RIPEMD_128() : MDx_HashFunction(64, false, true), M(16), digest(4)
+ RIPEMD_128() : MDx_HashFunction(64, false, true), m_M(16), m_digest(4)
{ clear(); }
private:
void compress_n(const byte[], size_t blocks) override;
void copy_out(byte[]) override;
- secure_vector<u32bit> M, digest;
+ secure_vector<u32bit> m_M, m_digest;
};
}
diff --git a/src/lib/hash/rmd160/rmd160.cpp b/src/lib/hash/rmd160/rmd160.cpp
index 56d063338..a48b97882 100644
--- a/src/lib/hash/rmd160/rmd160.cpp
+++ b/src/lib/hash/rmd160/rmd160.cpp
@@ -80,103 +80,103 @@ void RIPEMD_160::compress_n(const byte input[], size_t blocks)
for(size_t i = 0; i != blocks; ++i)
{
- load_le(M.data(), input, M.size());
-
- u32bit A1 = digest[0], A2 = A1, B1 = digest[1], B2 = B1,
- C1 = digest[2], C2 = C1, D1 = digest[3], D2 = D1,
- E1 = digest[4], E2 = E1;
-
- F1(A1,B1,C1,D1,E1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4(D1,E1,A1,B1,C1,M[ 6], 5,MAGIC4); F2(D2,E2,A2,B2,C2,M[10],15,MAGIC9);
- F4(C1,D1,E1,A1,B1,M[ 2],12,MAGIC4); F2(C2,D2,E2,A2,B2,M[14], 8,MAGIC9);
-
- F5(B1,C1,D1,E1,A1,M[ 4], 9,MAGIC5); F1(B2,C2,D2,E2,A2,M[12], 8 );
- F5(A1,B1,C1,D1,E1,M[ 0],15,MAGIC5); F1(A2,B2,C2,D2,E2,M[15], 5 );
- F5(E1,A1,B1,C1,D1,M[ 5], 5,MAGIC5); F1(E2,A2,B2,C2,D2,M[10],12 );
- F5(D1,E1,A1,B1,C1,M[ 9],11,MAGIC5); F1(D2,E2,A2,B2,C2,M[ 4], 9 );
- F5(C1,D1,E1,A1,B1,M[ 7], 6,MAGIC5); F1(C2,D2,E2,A2,B2,M[ 1],12 );
- F5(B1,C1,D1,E1,A1,M[12], 8,MAGIC5); F1(B2,C2,D2,E2,A2,M[ 5], 5 );
- F5(A1,B1,C1,D1,E1,M[ 2],13,MAGIC5); F1(A2,B2,C2,D2,E2,M[ 8],14 );
- F5(E1,A1,B1,C1,D1,M[10],12,MAGIC5); F1(E2,A2,B2,C2,D2,M[ 7], 6 );
- F5(D1,E1,A1,B1,C1,M[14], 5,MAGIC5); F1(D2,E2,A2,B2,C2,M[ 6], 8 );
- F5(C1,D1,E1,A1,B1,M[ 1],12,MAGIC5); F1(C2,D2,E2,A2,B2,M[ 2],13 );
- F5(B1,C1,D1,E1,A1,M[ 3],13,MAGIC5); F1(B2,C2,D2,E2,A2,M[13], 6 );
- F5(A1,B1,C1,D1,E1,M[ 8],14,MAGIC5); F1(A2,B2,C2,D2,E2,M[14], 5 );
- F5(E1,A1,B1,C1,D1,M[11],11,MAGIC5); F1(E2,A2,B2,C2,D2,M[ 0],15 );
- F5(D1,E1,A1,B1,C1,M[ 6], 8,MAGIC5); F1(D2,E2,A2,B2,C2,M[ 3],13 );
- F5(C1,D1,E1,A1,B1,M[15], 5,MAGIC5); F1(C2,D2,E2,A2,B2,M[ 9],11 );
- F5(B1,C1,D1,E1,A1,M[13], 6,MAGIC5); F1(B2,C2,D2,E2,A2,M[11],11 );
-
- C1 = digest[1] + C1 + D2;
- digest[1] = digest[2] + D1 + E2;
- digest[2] = digest[3] + E1 + A2;
- digest[3] = digest[4] + A1 + B2;
- digest[4] = digest[0] + B1 + C2;
- digest[0] = C1;
+ load_le(m_M.data(), input, m_M.size());
+
+ u32bit A1 = m_digest[0], A2 = A1, B1 = m_digest[1], B2 = B1,
+ C1 = m_digest[2], C2 = C1, D1 = m_digest[3], D2 = D1,
+ E1 = m_digest[4], E2 = E1;
+
+ F1(A1,B1,C1,D1,E1,m_M[ 0],11 ); F5(A2,B2,C2,D2,E2,m_M[ 5], 8,MAGIC6);
+ F1(E1,A1,B1,C1,D1,m_M[ 1],14 ); F5(E2,A2,B2,C2,D2,m_M[14], 9,MAGIC6);
+ F1(D1,E1,A1,B1,C1,m_M[ 2],15 ); F5(D2,E2,A2,B2,C2,m_M[ 7], 9,MAGIC6);
+ F1(C1,D1,E1,A1,B1,m_M[ 3],12 ); F5(C2,D2,E2,A2,B2,m_M[ 0],11,MAGIC6);
+ F1(B1,C1,D1,E1,A1,m_M[ 4], 5 ); F5(B2,C2,D2,E2,A2,m_M[ 9],13,MAGIC6);
+ F1(A1,B1,C1,D1,E1,m_M[ 5], 8 ); F5(A2,B2,C2,D2,E2,m_M[ 2],15,MAGIC6);
+ F1(E1,A1,B1,C1,D1,m_M[ 6], 7 ); F5(E2,A2,B2,C2,D2,m_M[11],15,MAGIC6);
+ F1(D1,E1,A1,B1,C1,m_M[ 7], 9 ); F5(D2,E2,A2,B2,C2,m_M[ 4], 5,MAGIC6);
+ F1(C1,D1,E1,A1,B1,m_M[ 8],11 ); F5(C2,D2,E2,A2,B2,m_M[13], 7,MAGIC6);
+ F1(B1,C1,D1,E1,A1,m_M[ 9],13 ); F5(B2,C2,D2,E2,A2,m_M[ 6], 7,MAGIC6);
+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B1,C1,m_M[ 9],11,MAGIC5); F1(D2,E2,A2,B2,C2,m_M[ 4], 9 );
+ F5(C1,D1,E1,A1,B1,m_M[ 7], 6,MAGIC5); F1(C2,D2,E2,A2,B2,m_M[ 1],12 );
+ F5(B1,C1,D1,E1,A1,m_M[12], 8,MAGIC5); F1(B2,C2,D2,E2,A2,m_M[ 5], 5 );
+ F5(A1,B1,C1,D1,E1,m_M[ 2],13,MAGIC5); F1(A2,B2,C2,D2,E2,m_M[ 8],14 );
+ F5(E1,A1,B1,C1,D1,m_M[10],12,MAGIC5); F1(E2,A2,B2,C2,D2,m_M[ 7], 6 );
+ F5(D1,E1,A1,B1,C1,m_M[14], 5,MAGIC5); F1(D2,E2,A2,B2,C2,m_M[ 6], 8 );
+ F5(C1,D1,E1,A1,B1,m_M[ 1],12,MAGIC5); F1(C2,D2,E2,A2,B2,m_M[ 2],13 );
+ F5(B1,C1,D1,E1,A1,m_M[ 3],13,MAGIC5); F1(B2,C2,D2,E2,A2,m_M[13], 6 );
+ F5(A1,B1,C1,D1,E1,m_M[ 8],14,MAGIC5); F1(A2,B2,C2,D2,E2,m_M[14], 5 );
+ F5(E1,A1,B1,C1,D1,m_M[11],11,MAGIC5); F1(E2,A2,B2,C2,D2,m_M[ 0],15 );
+ F5(D1,E1,A1,B1,C1,m_M[ 6], 8,MAGIC5); F1(D2,E2,A2,B2,C2,m_M[ 3],13 );
+ F5(C1,D1,E1,A1,B1,m_M[15], 5,MAGIC5); F1(C2,D2,E2,A2,B2,m_M[ 9],11 );
+ F5(B1,C1,D1,E1,A1,m_M[13], 6,MAGIC5); F1(B2,C2,D2,E2,A2,m_M[11],11 );
+
+ C1 = m_digest[1] + C1 + D2;
+ m_digest[1] = m_digest[2] + D1 + E2;
+ m_digest[2] = m_digest[3] + E1 + A2;
+ m_digest[3] = m_digest[4] + A1 + B2;
+ m_digest[4] = m_digest[0] + B1 + C2;
+ m_digest[0] = C1;
input += hash_block_size();
}
@@ -187,7 +187,7 @@ void RIPEMD_160::compress_n(const byte input[], size_t blocks)
*/
void RIPEMD_160::copy_out(byte output[])
{
- copy_out_vec_le(output, output_length(), digest);
+ copy_out_vec_le(output, output_length(), m_digest);
}
/*
@@ -196,12 +196,12 @@ void RIPEMD_160::copy_out(byte output[])
void RIPEMD_160::clear()
{
MDx_HashFunction::clear();
- zeroise(M);
- digest[0] = 0x67452301;
- digest[1] = 0xEFCDAB89;
- digest[2] = 0x98BADCFE;
- digest[3] = 0x10325476;
- digest[4] = 0xC3D2E1F0;
+ zeroise(m_M);
+ m_digest[0] = 0x67452301;
+ m_digest[1] = 0xEFCDAB89;
+ m_digest[2] = 0x98BADCFE;
+ m_digest[3] = 0x10325476;
+ m_digest[4] = 0xC3D2E1F0;
}
}
diff --git a/src/lib/hash/rmd160/rmd160.h b/src/lib/hash/rmd160/rmd160.h
index ad7182404..4ee6863de 100644
--- a/src/lib/hash/rmd160/rmd160.h
+++ b/src/lib/hash/rmd160/rmd160.h
@@ -24,13 +24,13 @@ class BOTAN_DLL RIPEMD_160 : public MDx_HashFunction
void clear() override;
- RIPEMD_160() : MDx_HashFunction(64, false, true), M(16), digest(5)
+ RIPEMD_160() : MDx_HashFunction(64, false, true), m_M(16), m_digest(5)
{ clear(); }
private:
void compress_n(const byte[], size_t blocks) override;
void copy_out(byte[]) override;
- secure_vector<u32bit> M, digest;
+ secure_vector<u32bit> m_M, m_digest;
};
}
diff --git a/src/lib/hash/sha1/sha160.cpp b/src/lib/hash/sha1/sha160.cpp
index 39d14f486..21e87465a 100644
--- a/src/lib/hash/sha1/sha160.cpp
+++ b/src/lib/hash/sha1/sha160.cpp
@@ -60,74 +60,74 @@ void SHA_160::compress_n(const byte input[], size_t blocks)
{
using namespace SHA1_F;
- u32bit A = digest[0], B = digest[1], C = digest[2],
- D = digest[3], E = digest[4];
+ u32bit A = m_digest[0], B = m_digest[1], C = m_digest[2],
+ D = m_digest[3], E = m_digest[4];
for(size_t i = 0; i != blocks; ++i)
{
- load_be(W.data(), input, 16);
+ load_be(m_W.data(), input, 16);
for(size_t j = 16; j != 80; j += 8)
{
- W[j ] = rotate_left((W[j-3] ^ W[j-8] ^ W[j-14] ^ W[j-16]), 1);
- W[j+1] = rotate_left((W[j-2] ^ W[j-7] ^ W[j-13] ^ W[j-15]), 1);
- W[j+2] = rotate_left((W[j-1] ^ W[j-6] ^ W[j-12] ^ W[j-14]), 1);
- W[j+3] = rotate_left((W[j ] ^ W[j-5] ^ W[j-11] ^ W[j-13]), 1);
- W[j+4] = rotate_left((W[j+1] ^ W[j-4] ^ W[j-10] ^ W[j-12]), 1);
- W[j+5] = rotate_left((W[j+2] ^ W[j-3] ^ W[j- 9] ^ W[j-11]), 1);
- W[j+6] = rotate_left((W[j+3] ^ W[j-2] ^ W[j- 8] ^ W[j-10]), 1);
- W[j+7] = rotate_left((W[j+4] ^ W[j-1] ^ W[j- 7] ^ W[j- 9]), 1);
+ m_W[j ] = rotate_left((m_W[j-3] ^ m_W[j-8] ^ m_W[j-14] ^ m_W[j-16]), 1);
+ m_W[j+1] = rotate_left((m_W[j-2] ^ m_W[j-7] ^ m_W[j-13] ^ m_W[j-15]), 1);
+ m_W[j+2] = rotate_left((m_W[j-1] ^ m_W[j-6] ^ m_W[j-12] ^ m_W[j-14]), 1);
+ m_W[j+3] = rotate_left((m_W[j ] ^ m_W[j-5] ^ m_W[j-11] ^ m_W[j-13]), 1);
+ m_W[j+4] = rotate_left((m_W[j+1] ^ m_W[j-4] ^ m_W[j-10] ^ m_W[j-12]), 1);
+ m_W[j+5] = rotate_left((m_W[j+2] ^ m_W[j-3] ^ m_W[j- 9] ^ m_W[j-11]), 1);
+ m_W[j+6] = rotate_left((m_W[j+3] ^ m_W[j-2] ^ m_W[j- 8] ^ m_W[j-10]), 1);
+ m_W[j+7] = rotate_left((m_W[j+4] ^ m_W[j-1] ^ m_W[j- 7] ^ m_W[j- 9]), 1);
}
- F1(A, B, C, D, E, W[ 0]); F1(E, A, B, C, D, W[ 1]);
- F1(D, E, A, B, C, W[ 2]); F1(C, D, E, A, B, W[ 3]);
- F1(B, C, D, E, A, W[ 4]); F1(A, B, C, D, E, W[ 5]);
- F1(E, A, B, C, D, W[ 6]); F1(D, E, A, B, C, W[ 7]);
- F1(C, D, E, A, B, W[ 8]); F1(B, C, D, E, A, W[ 9]);
- F1(A, B, C, D, E, W[10]); F1(E, A, B, C, D, W[11]);
- F1(D, E, A, B, C, W[12]); F1(C, D, E, A, B, W[13]);
- F1(B, C, D, E, A, W[14]); F1(A, B, C, D, E, W[15]);
- F1(E, A, B, C, D, W[16]); F1(D, E, A, B, C, W[17]);
- F1(C, D, E, A, B, W[18]); F1(B, C, D, E, A, W[19]);
-
- F2(A, B, C, D, E, W[20]); F2(E, A, B, C, D, W[21]);
- F2(D, E, A, B, C, W[22]); F2(C, D, E, A, B, W[23]);
- F2(B, C, D, E, A, W[24]); F2(A, B, C, D, E, W[25]);
- F2(E, A, B, C, D, W[26]); F2(D, E, A, B, C, W[27]);
- F2(C, D, E, A, B, W[28]); F2(B, C, D, E, A, W[29]);
- F2(A, B, C, D, E, W[30]); F2(E, A, B, C, D, W[31]);
- F2(D, E, A, B, C, W[32]); F2(C, D, E, A, B, W[33]);
- F2(B, C, D, E, A, W[34]); F2(A, B, C, D, E, W[35]);
- F2(E, A, B, C, D, W[36]); F2(D, E, A, B, C, W[37]);
- F2(C, D, E, A, B, W[38]); F2(B, C, D, E, A, W[39]);
-
- F3(A, B, C, D, E, W[40]); F3(E, A, B, C, D, W[41]);
- F3(D, E, A, B, C, W[42]); F3(C, D, E, A, B, W[43]);
- F3(B, C, D, E, A, W[44]); F3(A, B, C, D, E, W[45]);
- F3(E, A, B, C, D, W[46]); F3(D, E, A, B, C, W[47]);
- F3(C, D, E, A, B, W[48]); F3(B, C, D, E, A, W[49]);
- F3(A, B, C, D, E, W[50]); F3(E, A, B, C, D, W[51]);
- F3(D, E, A, B, C, W[52]); F3(C, D, E, A, B, W[53]);
- F3(B, C, D, E, A, W[54]); F3(A, B, C, D, E, W[55]);
- F3(E, A, B, C, D, W[56]); F3(D, E, A, B, C, W[57]);
- F3(C, D, E, A, B, W[58]); F3(B, C, D, E, A, W[59]);
-
- F4(A, B, C, D, E, W[60]); F4(E, A, B, C, D, W[61]);
- F4(D, E, A, B, C, W[62]); F4(C, D, E, A, B, W[63]);
- F4(B, C, D, E, A, W[64]); F4(A, B, C, D, E, W[65]);
- F4(E, A, B, C, D, W[66]); F4(D, E, A, B, C, W[67]);
- F4(C, D, E, A, B, W[68]); F4(B, C, D, E, A, W[69]);
- F4(A, B, C, D, E, W[70]); F4(E, A, B, C, D, W[71]);
- F4(D, E, A, B, C, W[72]); F4(C, D, E, A, B, W[73]);
- F4(B, C, D, E, A, W[74]); F4(A, B, C, D, E, W[75]);
- F4(E, A, B, C, D, W[76]); F4(D, E, A, B, C, W[77]);
- F4(C, D, E, A, B, W[78]); F4(B, C, D, E, A, W[79]);
-
- A = (digest[0] += A);
- B = (digest[1] += B);
- C = (digest[2] += C);
- D = (digest[3] += D);
- E = (digest[4] += E);
+ F1(A, B, C, D, E, m_W[ 0]); F1(E, A, B, C, D, m_W[ 1]);
+ F1(D, E, A, B, C, m_W[ 2]); F1(C, D, E, A, B, m_W[ 3]);
+ F1(B, C, D, E, A, m_W[ 4]); F1(A, B, C, D, E, m_W[ 5]);
+ F1(E, A, B, C, D, m_W[ 6]); F1(D, E, A, B, C, m_W[ 7]);
+ F1(C, D, E, A, B, m_W[ 8]); F1(B, C, D, E, A, m_W[ 9]);
+ F1(A, B, C, D, E, m_W[10]); F1(E, A, B, C, D, m_W[11]);
+ F1(D, E, A, B, C, m_W[12]); F1(C, D, E, A, B, m_W[13]);
+ F1(B, C, D, E, A, m_W[14]); F1(A, B, C, D, E, m_W[15]);
+ F1(E, A, B, C, D, m_W[16]); F1(D, E, A, B, C, m_W[17]);
+ F1(C, D, E, A, B, m_W[18]); F1(B, C, D, E, A, m_W[19]);
+
+ F2(A, B, C, D, E, m_W[20]); F2(E, A, B, C, D, m_W[21]);
+ F2(D, E, A, B, C, m_W[22]); F2(C, D, E, A, B, m_W[23]);
+ F2(B, C, D, E, A, m_W[24]); F2(A, B, C, D, E, m_W[25]);
+ F2(E, A, B, C, D, m_W[26]); F2(D, E, A, B, C, m_W[27]);
+ F2(C, D, E, A, B, m_W[28]); F2(B, C, D, E, A, m_W[29]);
+ F2(A, B, C, D, E, m_W[30]); F2(E, A, B, C, D, m_W[31]);
+ F2(D, E, A, B, C, m_W[32]); F2(C, D, E, A, B, m_W[33]);
+ F2(B, C, D, E, A, m_W[34]); F2(A, B, C, D, E, m_W[35]);
+ F2(E, A, B, C, D, m_W[36]); F2(D, E, A, B, C, m_W[37]);
+ F2(C, D, E, A, B, m_W[38]); F2(B, C, D, E, A, m_W[39]);
+
+ F3(A, B, C, D, E, m_W[40]); F3(E, A, B, C, D, m_W[41]);
+ F3(D, E, A, B, C, m_W[42]); F3(C, D, E, A, B, m_W[43]);
+ F3(B, C, D, E, A, m_W[44]); F3(A, B, C, D, E, m_W[45]);
+ F3(E, A, B, C, D, m_W[46]); F3(D, E, A, B, C, m_W[47]);
+ F3(C, D, E, A, B, m_W[48]); F3(B, C, D, E, A, m_W[49]);
+ F3(A, B, C, D, E, m_W[50]); F3(E, A, B, C, D, m_W[51]);
+ F3(D, E, A, B, C, m_W[52]); F3(C, D, E, A, B, m_W[53]);
+ F3(B, C, D, E, A, m_W[54]); F3(A, B, C, D, E, m_W[55]);
+ F3(E, A, B, C, D, m_W[56]); F3(D, E, A, B, C, m_W[57]);
+ F3(C, D, E, A, B, m_W[58]); F3(B, C, D, E, A, m_W[59]);
+
+ F4(A, B, C, D, E, m_W[60]); F4(E, A, B, C, D, m_W[61]);
+ F4(D, E, A, B, C, m_W[62]); F4(C, D, E, A, B, m_W[63]);
+ F4(B, C, D, E, A, m_W[64]); F4(A, B, C, D, E, m_W[65]);
+ F4(E, A, B, C, D, m_W[66]); F4(D, E, A, B, C, m_W[67]);
+ F4(C, D, E, A, B, m_W[68]); F4(B, C, D, E, A, m_W[69]);
+ F4(A, B, C, D, E, m_W[70]); F4(E, A, B, C, D, m_W[71]);
+ F4(D, E, A, B, C, m_W[72]); F4(C, D, E, A, B, m_W[73]);
+ F4(B, C, D, E, A, m_W[74]); F4(A, B, C, D, E, m_W[75]);
+ F4(E, A, B, C, D, m_W[76]); F4(D, E, A, B, C, m_W[77]);
+ F4(C, D, E, A, B, m_W[78]); F4(B, C, D, E, A, m_W[79]);
+
+ A = (m_digest[0] += A);
+ B = (m_digest[1] += B);
+ C = (m_digest[2] += C);
+ D = (m_digest[3] += D);
+ E = (m_digest[4] += E);
input += hash_block_size();
}
@@ -138,7 +138,7 @@ void SHA_160::compress_n(const byte input[], size_t blocks)
*/
void SHA_160::copy_out(byte output[])
{
- copy_out_vec_be(output, output_length(), digest);
+ copy_out_vec_be(output, output_length(), m_digest);
}
/*
@@ -147,12 +147,12 @@ void SHA_160::copy_out(byte output[])
void SHA_160::clear()
{
MDx_HashFunction::clear();
- zeroise(W);
- digest[0] = 0x67452301;
- digest[1] = 0xEFCDAB89;
- digest[2] = 0x98BADCFE;
- digest[3] = 0x10325476;
- digest[4] = 0xC3D2E1F0;
+ zeroise(m_W);
+ m_digest[0] = 0x67452301;
+ m_digest[1] = 0xEFCDAB89;
+ m_digest[2] = 0x98BADCFE;
+ m_digest[3] = 0x10325476;
+ m_digest[4] = 0xC3D2E1F0;
}
}
diff --git a/src/lib/hash/sha1/sha160.h b/src/lib/hash/sha1/sha160.h
index 6328d74c4..2f5d9b16e 100644
--- a/src/lib/hash/sha1/sha160.h
+++ b/src/lib/hash/sha1/sha160.h
@@ -24,7 +24,7 @@ class BOTAN_DLL SHA_160 : public MDx_HashFunction
void clear() override;
- SHA_160() : MDx_HashFunction(64, true, true), digest(5), W(80)
+ SHA_160() : MDx_HashFunction(64, true, true), m_digest(5), m_W(80)
{
clear();
}
@@ -36,7 +36,7 @@ class BOTAN_DLL SHA_160 : public MDx_HashFunction
* @param W_size how big to make W
*/
SHA_160(size_t W_size) :
- MDx_HashFunction(64, true, true), digest(5), W(W_size)
+ MDx_HashFunction(64, true, true), m_digest(5), m_W(W_size)
{
clear();
}
@@ -47,12 +47,12 @@ class BOTAN_DLL SHA_160 : public MDx_HashFunction
/**
* The digest value, exposed for use by subclasses (asm, SSE2)
*/
- secure_vector<u32bit> digest;
+ secure_vector<u32bit> m_digest;
/**
* The message buffer, exposed for use by subclasses (asm, SSE2)
*/
- secure_vector<u32bit> W;
+ secure_vector<u32bit> m_W;
};
}
diff --git a/src/lib/hash/sha1_sse2/sha1_sse2.cpp b/src/lib/hash/sha1_sse2/sha1_sse2.cpp
index 2e0688185..14ad88bc4 100644
--- a/src/lib/hash/sha1_sse2/sha1_sse2.cpp
+++ b/src/lib/hash/sha1_sse2/sha1_sse2.cpp
@@ -161,11 +161,11 @@ void SHA_160_SSE2::compress_n(const byte input_bytes[], size_t blocks)
const __m128i K40_59 = _mm_set1_epi32(0x8F1BBCDC);
const __m128i K60_79 = _mm_set1_epi32(0xCA62C1D6);
- u32bit A = digest[0],
- B = digest[1],
- C = digest[2],
- D = digest[3],
- E = digest[4];
+ u32bit A = m_digest[0],
+ B = m_digest[1],
+ C = m_digest[2],
+ D = m_digest[3],
+ E = m_digest[4];
const __m128i* input = reinterpret_cast<const __m128i*>(input_bytes);
@@ -316,11 +316,11 @@ void SHA_160_SSE2::compress_n(const byte input_bytes[], size_t blocks)
F4(C, D, E, A, B, GET_P_32(P3, 2));
F4(B, C, D, E, A, GET_P_32(P3, 3));
- A = (digest[0] += A);
- B = (digest[1] += B);
- C = (digest[2] += C);
- D = (digest[3] += D);
- E = (digest[4] += E);
+ A = (m_digest[0] += A);
+ B = (m_digest[1] += B);
+ C = (m_digest[2] += C);
+ D = (m_digest[3] += D);
+ E = (m_digest[4] += E);
input += (hash_block_size() / 16);
}
diff --git a/src/lib/hash/sha2_32/sha2_32.cpp b/src/lib/hash/sha2_32/sha2_32.cpp
index 5215164cf..46551431c 100644
--- a/src/lib/hash/sha2_32/sha2_32.cpp
+++ b/src/lib/hash/sha2_32/sha2_32.cpp
@@ -161,7 +161,7 @@ void compress(secure_vector<u32bit>& digest,
*/
void SHA_224::compress_n(const byte input[], size_t blocks)
{
- SHA2_32::compress(digest, input, blocks);
+ SHA2_32::compress(m_digest, input, blocks);
}
/*
@@ -169,7 +169,7 @@ void SHA_224::compress_n(const byte input[], size_t blocks)
*/
void SHA_224::copy_out(byte output[])
{
- copy_out_vec_be(output, output_length(), digest);
+ copy_out_vec_be(output, output_length(), m_digest);
}
/*
@@ -178,14 +178,14 @@ void SHA_224::copy_out(byte output[])
void SHA_224::clear()
{
MDx_HashFunction::clear();
- digest[0] = 0xC1059ED8;
- digest[1] = 0x367CD507;
- digest[2] = 0x3070DD17;
- digest[3] = 0xF70E5939;
- digest[4] = 0xFFC00B31;
- digest[5] = 0x68581511;
- digest[6] = 0x64F98FA7;
- digest[7] = 0xBEFA4FA4;
+ m_digest[0] = 0xC1059ED8;
+ m_digest[1] = 0x367CD507;
+ m_digest[2] = 0x3070DD17;
+ m_digest[3] = 0xF70E5939;
+ m_digest[4] = 0xFFC00B31;
+ m_digest[5] = 0x68581511;
+ m_digest[6] = 0x64F98FA7;
+ m_digest[7] = 0xBEFA4FA4;
}
/*
@@ -193,7 +193,7 @@ void SHA_224::clear()
*/
void SHA_256::compress_n(const byte input[], size_t blocks)
{
- SHA2_32::compress(digest, input, blocks);
+ SHA2_32::compress(m_digest, input, blocks);
}
/*
@@ -201,7 +201,7 @@ void SHA_256::compress_n(const byte input[], size_t blocks)
*/
void SHA_256::copy_out(byte output[])
{
- copy_out_vec_be(output, output_length(), digest);
+ copy_out_vec_be(output, output_length(), m_digest);
}
/*
@@ -210,14 +210,14 @@ void SHA_256::copy_out(byte output[])
void SHA_256::clear()
{
MDx_HashFunction::clear();
- digest[0] = 0x6A09E667;
- digest[1] = 0xBB67AE85;
- digest[2] = 0x3C6EF372;
- digest[3] = 0xA54FF53A;
- digest[4] = 0x510E527F;
- digest[5] = 0x9B05688C;
- digest[6] = 0x1F83D9AB;
- digest[7] = 0x5BE0CD19;
+ m_digest[0] = 0x6A09E667;
+ m_digest[1] = 0xBB67AE85;
+ m_digest[2] = 0x3C6EF372;
+ m_digest[3] = 0xA54FF53A;
+ m_digest[4] = 0x510E527F;
+ m_digest[5] = 0x9B05688C;
+ m_digest[6] = 0x1F83D9AB;
+ m_digest[7] = 0x5BE0CD19;
}
}
diff --git a/src/lib/hash/sha2_32/sha2_32.h b/src/lib/hash/sha2_32/sha2_32.h
index e51087dc1..46d022ae8 100644
--- a/src/lib/hash/sha2_32/sha2_32.h
+++ b/src/lib/hash/sha2_32/sha2_32.h
@@ -25,13 +25,13 @@ class BOTAN_DLL SHA_224 : public MDx_HashFunction
void clear() override;
- SHA_224() : MDx_HashFunction(64, true, true), digest(8)
+ SHA_224() : MDx_HashFunction(64, true, true), m_digest(8)
{ clear(); }
private:
void compress_n(const byte[], size_t blocks) override;
void copy_out(byte[]) override;
- secure_vector<u32bit> digest;
+ secure_vector<u32bit> m_digest;
};
/**
@@ -46,13 +46,13 @@ class BOTAN_DLL SHA_256 : public MDx_HashFunction
void clear() override;
- SHA_256() : MDx_HashFunction(64, true, true), digest(8)
+ SHA_256() : MDx_HashFunction(64, true, true), m_digest(8)
{ clear(); }
private:
void compress_n(const byte[], size_t blocks) override;
void copy_out(byte[]) override;
- secure_vector<u32bit> digest;
+ secure_vector<u32bit> m_digest;
};
}
diff --git a/src/lib/hash/skein/skein_512.cpp b/src/lib/hash/skein/skein_512.cpp
index fe95dd7a5..ad0817da7 100644
--- a/src/lib/hash/skein/skein_512.cpp
+++ b/src/lib/hash/skein/skein_512.cpp
@@ -19,12 +19,12 @@ Skein_512* Skein_512::make(const Spec& spec)
Skein_512::Skein_512(size_t arg_output_bits,
const std::string& arg_personalization) :
- personalization(arg_personalization),
- output_bits(arg_output_bits),
+ m_personalization(arg_personalization),
+ m_output_bits(arg_output_bits),
m_threefish(new Threefish_512),
- T(2), buffer(64), buf_pos(0)
+ m_T(2), m_buffer(64), m_buf_pos(0)
{
- if(output_bits == 0 || output_bits % 8 != 0 || output_bits > 512)
+ if(m_output_bits == 0 || m_output_bits % 8 != 0 || m_output_bits > 512)
throw Invalid_Argument("Bad output bits size for Skein-512");
initial_block();
@@ -32,30 +32,30 @@ Skein_512::Skein_512(size_t arg_output_bits,
std::string Skein_512::name() const
{
- if(personalization != "")
- return "Skein-512(" + std::to_string(output_bits) + "," +
- personalization + ")";
- return "Skein-512(" + std::to_string(output_bits) + ")";
+ if(m_personalization != "")
+ return "Skein-512(" + std::to_string(m_output_bits) + "," +
+ m_personalization + ")";
+ return "Skein-512(" + std::to_string(m_output_bits) + ")";
}
HashFunction* Skein_512::clone() const
{
- return new Skein_512(output_bits, personalization);
+ return new Skein_512(m_output_bits, m_personalization);
}
void Skein_512::clear()
{
- zeroise(buffer);
- buf_pos = 0;
+ zeroise(m_buffer);
+ m_buf_pos = 0;
initial_block();
}
void Skein_512::reset_tweak(type_code type, bool final)
{
- T[0] = 0;
+ m_T[0] = 0;
- T[1] = (static_cast<u64bit>(type) << 56) |
+ m_T[1] = (static_cast<u64bit>(type) << 56) |
(static_cast<u64bit>(1) << 62) |
(static_cast<u64bit>(final) << 63);
}
@@ -68,24 +68,24 @@ void Skein_512::initial_block()
// ASCII("SHA3") followed by version (0x0001) code
byte config_str[32] = { 0x53, 0x48, 0x41, 0x33, 0x01, 0x00, 0 };
- store_le(u32bit(output_bits), config_str + 8);
+ store_le(u32bit(m_output_bits), config_str + 8);
reset_tweak(SKEIN_CONFIG, true);
ubi_512(config_str, sizeof(config_str));
- if(personalization != "")
+ if(m_personalization != "")
{
/*
This is a limitation of this implementation, and not of the
algorithm specification. Could be fixed relatively easily, but
doesn't seem worth the trouble.
*/
- if(personalization.length() > 64)
+ if(m_personalization.length() > 64)
throw Invalid_Argument("Skein personalization must be less than 64 bytes");
- const byte* bits = reinterpret_cast<const byte*>(personalization.data());
+ const byte* bits = reinterpret_cast<const byte*>(m_personalization.data());
reset_tweak(SKEIN_PERSONALIZATION, true);
- ubi_512(bits, personalization.length());
+ ubi_512(bits, m_personalization.length());
}
reset_tweak(SKEIN_MSG, false);
@@ -98,7 +98,7 @@ void Skein_512::ubi_512(const byte msg[], size_t msg_len)
do
{
const size_t to_proc = std::min<size_t>(msg_len, 64);
- T[0] += to_proc;
+ m_T[0] += to_proc;
load_le(M.data(), msg, to_proc / 8);
@@ -108,10 +108,10 @@ void Skein_512::ubi_512(const byte msg[], size_t msg_len)
M[to_proc/8] |= static_cast<u64bit>(msg[8*(to_proc/8)+j]) << (8*j);
}
- m_threefish->skein_feedfwd(M, T);
+ m_threefish->skein_feedfwd(M, m_T);
// clear first flag if set
- T[1] &= ~(static_cast<u64bit>(1) << 62);
+ m_T[1] &= ~(static_cast<u64bit>(1) << 62);
msg_len -= to_proc;
msg += to_proc;
@@ -123,16 +123,16 @@ void Skein_512::add_data(const byte input[], size_t length)
if(length == 0)
return;
- if(buf_pos)
+ if(m_buf_pos)
{
- buffer_insert(buffer, buf_pos, input, length);
- if(buf_pos + length > 64)
+ buffer_insert(m_buffer, m_buf_pos, input, length);
+ if(m_buf_pos + length > 64)
{
- ubi_512(buffer.data(), buffer.size());
+ ubi_512(m_buffer.data(), m_buffer.size());
- input += (64 - buf_pos);
- length -= (64 - buf_pos);
- buf_pos = 0;
+ input += (64 - m_buf_pos);
+ length -= (64 - m_buf_pos);
+ m_buf_pos = 0;
}
}
@@ -143,27 +143,27 @@ void Skein_512::add_data(const byte input[], size_t length)
length -= full_blocks * 64;
- buffer_insert(buffer, buf_pos, input + full_blocks * 64, length);
- buf_pos += length;
+ buffer_insert(m_buffer, m_buf_pos, input + full_blocks * 64, length);
+ m_buf_pos += length;
}
void Skein_512::final_result(byte out[])
{
- T[1] |= (static_cast<u64bit>(1) << 63); // final block flag
+ m_T[1] |= (static_cast<u64bit>(1) << 63); // final block flag
- for(size_t i = buf_pos; i != buffer.size(); ++i)
- buffer[i] = 0;
+ for(size_t i = m_buf_pos; i != m_buffer.size(); ++i)
+ m_buffer[i] = 0;
- ubi_512(buffer.data(), buf_pos);
+ ubi_512(m_buffer.data(), m_buf_pos);
const byte counter[8] = { 0 };
reset_tweak(SKEIN_OUTPUT, true);
ubi_512(counter, sizeof(counter));
- copy_out_vec_le(out, output_bits / 8, m_threefish->m_K);
+ copy_out_vec_le(out, m_output_bits / 8, m_threefish->m_K);
- buf_pos = 0;
+ m_buf_pos = 0;
initial_block();
}
diff --git a/src/lib/hash/skein/skein_512.h b/src/lib/hash/skein/skein_512.h
index dceb34854..9d3c69fb2 100644
--- a/src/lib/hash/skein/skein_512.h
+++ b/src/lib/hash/skein/skein_512.h
@@ -30,7 +30,7 @@ class BOTAN_DLL Skein_512 : public HashFunction
const std::string& personalization = "");
size_t hash_block_size() const override { return 64; }
- size_t output_length() const override { return output_bits / 8; }
+ size_t output_length() const override { return m_output_bits / 8; }
static Skein_512* make(const Spec& spec);
@@ -57,13 +57,13 @@ class BOTAN_DLL Skein_512 : public HashFunction
void initial_block();
void reset_tweak(type_code type, bool final);
- std::string personalization;
- size_t output_bits;
+ std::string m_personalization;
+ size_t m_output_bits;
std::unique_ptr<Threefish_512> m_threefish;
- secure_vector<u64bit> T;
- secure_vector<byte> buffer;
- size_t buf_pos;
+ secure_vector<u64bit> m_T;
+ secure_vector<byte> m_buffer;
+ size_t m_buf_pos;
};
}
diff --git a/src/lib/hash/tiger/tiger.cpp b/src/lib/hash/tiger/tiger.cpp
index 79708a902..1da38291c 100644
--- a/src/lib/hash/tiger/tiger.cpp
+++ b/src/lib/hash/tiger/tiger.cpp
@@ -44,26 +44,26 @@ inline void mix(secure_vector<u64bit>& X)
*/
void Tiger::compress_n(const byte input[], size_t blocks)
{
- u64bit A = digest[0], B = digest[1], C = digest[2];
+ u64bit A = m_digest[0], B = m_digest[1], C = m_digest[2];
for(size_t i = 0; i != blocks; ++i)
{
- load_le(X.data(), input, X.size());
+ load_le(m_X.data(), input, m_X.size());
- pass(A, B, C, X, 5); mix(X);
- pass(C, A, B, X, 7); mix(X);
- pass(B, C, A, X, 9);
+ pass(A, B, C, m_X, 5); mix(m_X);
+ pass(C, A, B, m_X, 7); mix(m_X);
+ pass(B, C, A, m_X, 9);
- for(size_t j = 3; j != passes; ++j)
+ for(size_t j = 3; j != m_passes; ++j)
{
- mix(X);
- pass(A, B, C, X, 9);
+ mix(m_X);
+ pass(A, B, C, m_X, 9);
u64bit T = A; A = C; C = B; B = T;
}
- A = (digest[0] ^= A);
- B = digest[1] = B - digest[1];
- C = (digest[2] += C);
+ A = (m_digest[0] ^= A);
+ B = m_digest[1] = B - m_digest[1];
+ C = (m_digest[2] += C);
input += hash_block_size();
}
@@ -74,7 +74,7 @@ void Tiger::compress_n(const byte input[], size_t blocks)
*/
void Tiger::copy_out(byte output[])
{
- copy_out_vec_le(output, output_length(), digest);
+ copy_out_vec_le(output, output_length(), m_digest);
}
/*
@@ -147,10 +147,10 @@ void Tiger::pass(u64bit& A, u64bit& B, u64bit& C,
void Tiger::clear()
{
MDx_HashFunction::clear();
- zeroise(X);
- digest[0] = 0x0123456789ABCDEF;
- digest[1] = 0xFEDCBA9876543210;
- digest[2] = 0xF096A5B4C3B2E187;
+ zeroise(m_X);
+ m_digest[0] = 0x0123456789ABCDEF;
+ m_digest[1] = 0xFEDCBA9876543210;
+ m_digest[2] = 0xF096A5B4C3B2E187;
}
/*
@@ -159,7 +159,7 @@ void Tiger::clear()
std::string Tiger::name() const
{
return "Tiger(" + std::to_string(output_length()) + "," +
- std::to_string(passes) + ")";
+ std::to_string(m_passes) + ")";
}
/*
@@ -167,10 +167,10 @@ std::string Tiger::name() const
*/
Tiger::Tiger(size_t hash_len, size_t passes) :
MDx_HashFunction(64, false, false),
- X(8),
- digest(3),
- hash_len(hash_len),
- passes(passes)
+ m_X(8),
+ m_digest(3),
+ m_hash_len(hash_len),
+ m_passes(passes)
{
if(output_length() != 16 && output_length() != 20 && output_length() != 24)
throw Invalid_Argument("Tiger: Illegal hash output size: " +
diff --git a/src/lib/hash/tiger/tiger.h b/src/lib/hash/tiger/tiger.h
index 986186dda..6634b544f 100644
--- a/src/lib/hash/tiger/tiger.h
+++ b/src/lib/hash/tiger/tiger.h
@@ -19,11 +19,11 @@ class BOTAN_DLL Tiger : public MDx_HashFunction
{
public:
std::string name() const override;
- size_t output_length() const override { return hash_len; }
+ size_t output_length() const override { return m_hash_len; }
HashFunction* clone() const override
{
- return new Tiger(output_length(), passes);
+ return new Tiger(output_length(), m_passes);
}
void clear() override;
@@ -46,8 +46,8 @@ class BOTAN_DLL Tiger : public MDx_HashFunction
static const u64bit SBOX3[256];
static const u64bit SBOX4[256];
- secure_vector<u64bit> X, digest;
- const size_t hash_len, passes;
+ secure_vector<u64bit> m_X, m_digest;
+ const size_t m_hash_len, m_passes;
};
}
diff --git a/src/lib/hash/whirlpool/whirlpool.cpp b/src/lib/hash/whirlpool/whirlpool.cpp
index 9bebdfa7c..5bf4c5246 100644
--- a/src/lib/hash/whirlpool/whirlpool.cpp
+++ b/src/lib/hash/whirlpool/whirlpool.cpp
@@ -24,15 +24,15 @@ void Whirlpool::compress_n(const byte in[], size_t blocks)
for(size_t i = 0; i != blocks; ++i)
{
- load_be(M.data(), in, M.size());
+ load_be(m_M.data(), in, m_M.size());
u64bit K0, K1, K2, K3, K4, K5, K6, K7;
- K0 = digest[0]; K1 = digest[1]; K2 = digest[2]; K3 = digest[3];
- K4 = digest[4]; K5 = digest[5]; K6 = digest[6]; K7 = digest[7];
+ K0 = m_digest[0]; K1 = m_digest[1]; K2 = m_digest[2]; K3 = m_digest[3];
+ K4 = m_digest[4]; K5 = m_digest[5]; K6 = m_digest[6]; K7 = m_digest[7];
u64bit B0, B1, B2, B3, B4, B5, B6, B7;
- B0 = K0 ^ M[0]; B1 = K1 ^ M[1]; B2 = K2 ^ M[2]; B3 = K3 ^ M[3];
- B4 = K4 ^ M[4]; B5 = K5 ^ M[5]; B6 = K6 ^ M[6]; B7 = K7 ^ M[7];
+ B0 = K0 ^ m_M[0]; B1 = K1 ^ m_M[1]; B2 = K2 ^ m_M[2]; B3 = K3 ^ m_M[3];
+ B4 = K4 ^ m_M[4]; B5 = K5 ^ m_M[5]; B6 = K6 ^ m_M[6]; B7 = K7 ^ m_M[7];
for(size_t j = 0; j != 10; ++j)
{
@@ -110,14 +110,14 @@ void Whirlpool::compress_n(const byte in[], size_t blocks)
B4 = T4; B5 = T5; B6 = T6; B7 = T7;
}
- digest[0] ^= B0 ^ M[0];
- digest[1] ^= B1 ^ M[1];
- digest[2] ^= B2 ^ M[2];
- digest[3] ^= B3 ^ M[3];
- digest[4] ^= B4 ^ M[4];
- digest[5] ^= B5 ^ M[5];
- digest[6] ^= B6 ^ M[6];
- digest[7] ^= B7 ^ M[7];
+ m_digest[0] ^= B0 ^ m_M[0];
+ m_digest[1] ^= B1 ^ m_M[1];
+ m_digest[2] ^= B2 ^ m_M[2];
+ m_digest[3] ^= B3 ^ m_M[3];
+ m_digest[4] ^= B4 ^ m_M[4];
+ m_digest[5] ^= B5 ^ m_M[5];
+ m_digest[6] ^= B6 ^ m_M[6];
+ m_digest[7] ^= B7 ^ m_M[7];
in += hash_block_size();
}
@@ -128,7 +128,7 @@ void Whirlpool::compress_n(const byte in[], size_t blocks)
*/
void Whirlpool::copy_out(byte output[])
{
- copy_out_vec_be(output, output_length(), digest);
+ copy_out_vec_be(output, output_length(), m_digest);
}
/*
@@ -137,8 +137,8 @@ void Whirlpool::copy_out(byte output[])
void Whirlpool::clear()
{
MDx_HashFunction::clear();
- zeroise(M);
- zeroise(digest);
+ zeroise(m_M);
+ zeroise(m_digest);
}
}
diff --git a/src/lib/hash/whirlpool/whrlpool.h b/src/lib/hash/whirlpool/whrlpool.h
index ba91da080..c59d16cda 100644
--- a/src/lib/hash/whirlpool/whrlpool.h
+++ b/src/lib/hash/whirlpool/whrlpool.h
@@ -24,7 +24,7 @@ class BOTAN_DLL Whirlpool : public MDx_HashFunction
void clear() override;
- Whirlpool() : MDx_HashFunction(64, true, true, 32), M(8), digest(8)
+ Whirlpool() : MDx_HashFunction(64, true, true, 32), m_M(8), m_digest(8)
{ clear(); }
private:
void compress_n(const byte[], size_t blocks) override;
@@ -39,7 +39,7 @@ class BOTAN_DLL Whirlpool : public MDx_HashFunction
static const u64bit C6[256];
static const u64bit C7[256];
- secure_vector<u64bit> M, digest;
+ secure_vector<u64bit> m_M, m_digest;
};
}