aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/hash
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2015-06-26 00:17:56 +0200
committerSimon Warta <[email protected]>2015-06-27 10:57:40 +0200
commitc0d847700c2905d9f7eecf2835d2750b564fc65b (patch)
treeb48224cfa0db44700531d78f0aa98bce835bfce5 /src/lib/hash
parentd6044e49cefc7fb1415033ed7f7ed74e9a985d33 (diff)
lib/hash: Convert &vec[0] to vec.data()
Diffstat (limited to 'src/lib/hash')
-rw-r--r--src/lib/hash/comb4p/comb4p.cpp14
-rw-r--r--src/lib/hash/gost_3411/gost_3411.cpp20
-rw-r--r--src/lib/hash/has160/has160.cpp2
-rw-r--r--src/lib/hash/keccak/keccak.cpp4
-rw-r--r--src/lib/hash/md2/md2.cpp12
-rw-r--r--src/lib/hash/md4/md4.cpp2
-rw-r--r--src/lib/hash/md4_x86_32/md4_x86_32.cpp2
-rw-r--r--src/lib/hash/md5/md5.cpp2
-rw-r--r--src/lib/hash/md5_x86_32/md5_x86_32.cpp2
-rw-r--r--src/lib/hash/mdx_hash/mdx_hash.cpp6
-rw-r--r--src/lib/hash/rmd128/rmd128.cpp2
-rw-r--r--src/lib/hash/rmd160/rmd160.cpp2
-rw-r--r--src/lib/hash/sha1/sha160.cpp2
-rw-r--r--src/lib/hash/sha1_x86_32/sha1_x86_32.cpp2
-rw-r--r--src/lib/hash/sha1_x86_64/sha1_x86_64.cpp2
-rw-r--r--src/lib/hash/skein/skein_512.cpp6
-rw-r--r--src/lib/hash/tiger/tiger.cpp2
-rw-r--r--src/lib/hash/whirlpool/whirlpool.cpp2
18 files changed, 43 insertions, 43 deletions
diff --git a/src/lib/hash/comb4p/comb4p.cpp b/src/lib/hash/comb4p/comb4p.cpp
index 4797e2483..843c530ef 100644
--- a/src/lib/hash/comb4p/comb4p.cpp
+++ b/src/lib/hash/comb4p/comb4p.cpp
@@ -25,14 +25,14 @@ void comb4p_round(secure_vector<byte>& out,
h1.update(round_no);
h2.update(round_no);
- h1.update(&in[0], in.size());
- h2.update(&in[0], in.size());
+ h1.update(in.data(), in.size());
+ h2.update(in.data(), in.size());
secure_vector<byte> h_buf = h1.final();
- xor_buf(&out[0], &h_buf[0], std::min(out.size(), h_buf.size()));
+ xor_buf(out.data(), h_buf.data(), std::min(out.size(), h_buf.size()));
h_buf = h2.final();
- xor_buf(&out[0], &h_buf[0], std::min(out.size(), h_buf.size()));
+ xor_buf(out.data(), h_buf.data(), std::min(out.size(), h_buf.size()));
}
}
@@ -98,7 +98,7 @@ void Comb4P::final_result(byte out[])
secure_vector<byte> h2 = m_hash2->final();
// First round
- xor_buf(&h1[0], &h2[0], std::min(h1.size(), h2.size()));
+ xor_buf(h1.data(), h2.data(), std::min(h1.size(), h2.size()));
// Second round
comb4p_round(h2, h1, 1, *m_hash1, *m_hash2);
@@ -106,8 +106,8 @@ void Comb4P::final_result(byte out[])
// Third round
comb4p_round(h1, h2, 2, *m_hash1, *m_hash2);
- copy_mem(out , &h1[0], h1.size());
- copy_mem(out + h1.size(), &h2[0], h2.size());
+ copy_mem(out , h1.data(), h1.size());
+ copy_mem(out + h1.size(), h2.data(), h2.size());
// Prep for processing next message, if any
m_hash1->update(0);
diff --git a/src/lib/hash/gost_3411/gost_3411.cpp b/src/lib/hash/gost_3411/gost_3411.cpp
index ad1ee3b98..918556ca0 100644
--- a/src/lib/hash/gost_3411/gost_3411.cpp
+++ b/src/lib/hash/gost_3411/gost_3411.cpp
@@ -48,7 +48,7 @@ void GOST_34_11::add_data(const byte input[], size_t length)
if(position + length >= hash_block_size())
{
- compress_n(&buffer[0], 1);
+ compress_n(buffer.data(), 1);
input += (hash_block_size() - position);
length -= (hash_block_size() - position);
position = 0;
@@ -82,7 +82,7 @@ void GOST_34_11::compress_n(const byte input[], size_t blocks)
byte S[32] = { 0 };
u64bit U[4], V[4];
- load_be(U, &hash[0], 4);
+ load_be(U, hash.data(), 4);
load_be(V, input + 32*i, 4);
for(size_t j = 0; j != 4; ++j)
@@ -169,7 +169,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[0], 32);
+ xor_buf(S, 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];
@@ -211,7 +211,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[0], &S2[0], 32);
+ copy_mem(hash.data(), S2, 32);
}
}
@@ -222,20 +222,20 @@ void GOST_34_11::final_result(byte out[])
{
if(position)
{
- clear_mem(&buffer[0] + position, buffer.size() - position);
- compress_n(&buffer[0], 1);
+ clear_mem(buffer.data() + position, buffer.size() - position);
+ compress_n(buffer.data(), 1);
}
secure_vector<byte> length_buf(32);
const u64bit bit_count = count * 8;
- store_le(bit_count, &length_buf[0]);
+ store_le(bit_count, length_buf.data());
secure_vector<byte> sum_buf = sum;
- compress_n(&length_buf[0], 1);
- compress_n(&sum_buf[0], 1);
+ compress_n(length_buf.data(), 1);
+ compress_n(sum_buf.data(), 1);
- copy_mem(out, &hash[0], 32);
+ copy_mem(out, hash.data(), 32);
clear();
}
diff --git a/src/lib/hash/has160/has160.cpp b/src/lib/hash/has160/has160.cpp
index 2e6981657..2f2a5f9de 100644
--- a/src/lib/hash/has160/has160.cpp
+++ b/src/lib/hash/has160/has160.cpp
@@ -68,7 +68,7 @@ void HAS_160::compress_n(const byte input[], size_t blocks)
for(size_t i = 0; i != blocks; ++i)
{
- load_le(&X[0], input, 16);
+ 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];
diff --git a/src/lib/hash/keccak/keccak.cpp b/src/lib/hash/keccak/keccak.cpp
index 842b199a5..8ee2357b6 100644
--- a/src/lib/hash/keccak/keccak.cpp
+++ b/src/lib/hash/keccak/keccak.cpp
@@ -171,7 +171,7 @@ void Keccak_1600::add_data(const byte input[], size_t length)
if(S_pos == bitrate / 8)
{
- keccak_f_1600(&S[0]);
+ keccak_f_1600(S.data());
S_pos = 0;
}
}
@@ -184,7 +184,7 @@ void Keccak_1600::final_result(byte output[])
padding[0] = 0x01;
padding[padding.size()-1] |= 0x80;
- add_data(&padding[0], padding.size());
+ add_data(padding.data(), padding.size());
/*
* We never have to run the permutation again because we only support
diff --git a/src/lib/hash/md2/md2.cpp b/src/lib/hash/md2/md2.cpp
index 91d8154cf..6543cf1a0 100644
--- a/src/lib/hash/md2/md2.cpp
+++ b/src/lib/hash/md2/md2.cpp
@@ -43,7 +43,7 @@ void MD2::hash(const byte input[])
0x9F, 0x11, 0x83, 0x14 };
buffer_insert(X, 16, input, hash_block_size());
- xor_buf(&X[32], &X[0], &X[16], hash_block_size());
+ xor_buf(&X[32], X.data(), &X[16], hash_block_size());
byte T = 0;
for(size_t i = 0; i != 18; ++i)
@@ -73,7 +73,7 @@ void MD2::add_data(const byte input[], size_t length)
if(position + length >= hash_block_size())
{
- hash(&buffer[0]);
+ hash(buffer.data());
input += (hash_block_size() - position);
length -= (hash_block_size() - position);
while(length >= hash_block_size())
@@ -82,7 +82,7 @@ void MD2::add_data(const byte input[], size_t length)
input += hash_block_size();
length -= hash_block_size();
}
- copy_mem(&buffer[0], input, length);
+ copy_mem(buffer.data(), input, length);
position = 0;
}
position += length;
@@ -96,9 +96,9 @@ 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);
- hash(&buffer[0]);
- hash(&checksum[0]);
- copy_mem(output, &X[0], output_length());
+ hash(buffer.data());
+ hash(checksum.data());
+ copy_mem(output, X.data(), output_length());
clear();
}
diff --git a/src/lib/hash/md4/md4.cpp b/src/lib/hash/md4/md4.cpp
index d9a47315e..cc11baafa 100644
--- a/src/lib/hash/md4/md4.cpp
+++ b/src/lib/hash/md4/md4.cpp
@@ -52,7 +52,7 @@ void MD4::compress_n(const byte input[], size_t blocks)
for(size_t i = 0; i != blocks; ++i)
{
- load_le(&M[0], input, M.size());
+ 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);
diff --git a/src/lib/hash/md4_x86_32/md4_x86_32.cpp b/src/lib/hash/md4_x86_32/md4_x86_32.cpp
index 5cf7fd896..28860a369 100644
--- a/src/lib/hash/md4_x86_32/md4_x86_32.cpp
+++ b/src/lib/hash/md4_x86_32/md4_x86_32.cpp
@@ -29,7 +29,7 @@ void MD4_X86_32::compress_n(const byte input[], size_t blocks)
{
for(size_t i = 0; i != blocks; ++i)
{
- botan_md4_x86_32_compress(&digest[0], input, &M[0]);
+ botan_md4_x86_32_compress(digest.data(), input, M.data());
input += hash_block_size();
}
}
diff --git a/src/lib/hash/md5/md5.cpp b/src/lib/hash/md5/md5.cpp
index 772e51478..2ce8df48a 100644
--- a/src/lib/hash/md5/md5.cpp
+++ b/src/lib/hash/md5/md5.cpp
@@ -65,7 +65,7 @@ void MD5::compress_n(const byte input[], size_t blocks)
for(size_t i = 0; i != blocks; ++i)
{
- load_le(&M[0], input, M.size());
+ 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);
diff --git a/src/lib/hash/md5_x86_32/md5_x86_32.cpp b/src/lib/hash/md5_x86_32/md5_x86_32.cpp
index b5fd0c78f..083e90900 100644
--- a/src/lib/hash/md5_x86_32/md5_x86_32.cpp
+++ b/src/lib/hash/md5_x86_32/md5_x86_32.cpp
@@ -26,7 +26,7 @@ void MD5_X86_32::compress_n(const byte input[], size_t blocks)
{
for(size_t i = 0; i != blocks; ++i)
{
- botan_md5_x86_32_compress(&digest[0], input, &M[0]);
+ botan_md5_x86_32_compress(digest.data(), input, M.data());
input += hash_block_size();
}
}
diff --git a/src/lib/hash/mdx_hash/mdx_hash.cpp b/src/lib/hash/mdx_hash/mdx_hash.cpp
index de7e45540..bd754d3cc 100644
--- a/src/lib/hash/mdx_hash/mdx_hash.cpp
+++ b/src/lib/hash/mdx_hash/mdx_hash.cpp
@@ -48,7 +48,7 @@ void MDx_HashFunction::add_data(const byte input[], size_t length)
if(position + length >= buffer.size())
{
- compress_n(&buffer[0], 1);
+ compress_n(buffer.data(), 1);
input += (buffer.size() - position);
length -= (buffer.size() - position);
position = 0;
@@ -76,13 +76,13 @@ void MDx_HashFunction::final_result(byte output[])
if(position >= buffer.size() - COUNT_SIZE)
{
- compress_n(&buffer[0], 1);
+ compress_n(buffer.data(), 1);
zeroise(buffer);
}
write_count(&buffer[buffer.size() - COUNT_SIZE]);
- compress_n(&buffer[0], 1);
+ compress_n(buffer.data(), 1);
copy_out(output);
clear();
}
diff --git a/src/lib/hash/rmd128/rmd128.cpp b/src/lib/hash/rmd128/rmd128.cpp
index 84ac393bb..7138d54d7 100644
--- a/src/lib/hash/rmd128/rmd128.cpp
+++ b/src/lib/hash/rmd128/rmd128.cpp
@@ -69,7 +69,7 @@ void RIPEMD_128::compress_n(const byte input[], size_t blocks)
for(size_t i = 0; i != blocks; ++i)
{
- load_le(&M[0], input, M.size());
+ 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;
diff --git a/src/lib/hash/rmd160/rmd160.cpp b/src/lib/hash/rmd160/rmd160.cpp
index d58704fa0..dad1d367a 100644
--- a/src/lib/hash/rmd160/rmd160.cpp
+++ b/src/lib/hash/rmd160/rmd160.cpp
@@ -83,7 +83,7 @@ void RIPEMD_160::compress_n(const byte input[], size_t blocks)
for(size_t i = 0; i != blocks; ++i)
{
- load_le(&M[0], input, M.size());
+ 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,
diff --git a/src/lib/hash/sha1/sha160.cpp b/src/lib/hash/sha1/sha160.cpp
index be52d0d57..96bc2c682 100644
--- a/src/lib/hash/sha1/sha160.cpp
+++ b/src/lib/hash/sha1/sha160.cpp
@@ -68,7 +68,7 @@ void SHA_160::compress_n(const byte input[], size_t blocks)
for(size_t i = 0; i != blocks; ++i)
{
- load_be(&W[0], input, 16);
+ load_be(W.data(), input, 16);
for(size_t j = 16; j != 80; j += 8)
{
diff --git a/src/lib/hash/sha1_x86_32/sha1_x86_32.cpp b/src/lib/hash/sha1_x86_32/sha1_x86_32.cpp
index 449596db6..c5986221e 100644
--- a/src/lib/hash/sha1_x86_32/sha1_x86_32.cpp
+++ b/src/lib/hash/sha1_x86_32/sha1_x86_32.cpp
@@ -26,7 +26,7 @@ void SHA_160_X86_32::compress_n(const byte input[], size_t blocks)
{
for(size_t i = 0; i != blocks; ++i)
{
- botan_sha160_x86_32_compress(&digest[0], input, &W[0]);
+ botan_sha160_x86_32_compress(digest.data(), input, W.data());
input += hash_block_size();
}
}
diff --git a/src/lib/hash/sha1_x86_64/sha1_x86_64.cpp b/src/lib/hash/sha1_x86_64/sha1_x86_64.cpp
index 2f5e063bd..f2fbff1a6 100644
--- a/src/lib/hash/sha1_x86_64/sha1_x86_64.cpp
+++ b/src/lib/hash/sha1_x86_64/sha1_x86_64.cpp
@@ -26,7 +26,7 @@ void SHA_160_X86_64::compress_n(const byte input[], size_t blocks)
{
for(size_t i = 0; i != blocks; ++i)
{
- botan_sha160_x86_64_compress(&digest[0], input, &W[0]);
+ botan_sha160_x86_64_compress(digest.data(), input, W.data());
input += hash_block_size();
}
}
diff --git a/src/lib/hash/skein/skein_512.cpp b/src/lib/hash/skein/skein_512.cpp
index 1ade6bbc5..5e186b996 100644
--- a/src/lib/hash/skein/skein_512.cpp
+++ b/src/lib/hash/skein/skein_512.cpp
@@ -104,7 +104,7 @@ void Skein_512::ubi_512(const byte msg[], size_t msg_len)
const size_t to_proc = std::min<size_t>(msg_len, 64);
T[0] += to_proc;
- load_le(&M[0], msg, to_proc / 8);
+ load_le(M.data(), msg, to_proc / 8);
if(to_proc % 8)
{
@@ -132,7 +132,7 @@ void Skein_512::add_data(const byte input[], size_t length)
buffer_insert(buffer, buf_pos, input, length);
if(buf_pos + length > 64)
{
- ubi_512(&buffer[0], buffer.size());
+ ubi_512(buffer.data(), buffer.size());
input += (64 - buf_pos);
length -= (64 - buf_pos);
@@ -158,7 +158,7 @@ void Skein_512::final_result(byte out[])
for(size_t i = buf_pos; i != buffer.size(); ++i)
buffer[i] = 0;
- ubi_512(&buffer[0], buf_pos);
+ ubi_512(buffer.data(), buf_pos);
const byte counter[8] = { 0 };
diff --git a/src/lib/hash/tiger/tiger.cpp b/src/lib/hash/tiger/tiger.cpp
index 86da18d24..c6dec2f33 100644
--- a/src/lib/hash/tiger/tiger.cpp
+++ b/src/lib/hash/tiger/tiger.cpp
@@ -51,7 +51,7 @@ void Tiger::compress_n(const byte input[], size_t blocks)
for(size_t i = 0; i != blocks; ++i)
{
- load_le(&X[0], input, X.size());
+ load_le(X.data(), input, X.size());
pass(A, B, C, X, 5); mix(X);
pass(C, A, B, X, 7); mix(X);
diff --git a/src/lib/hash/whirlpool/whirlpool.cpp b/src/lib/hash/whirlpool/whirlpool.cpp
index 25b958e6d..573c49f91 100644
--- a/src/lib/hash/whirlpool/whirlpool.cpp
+++ b/src/lib/hash/whirlpool/whirlpool.cpp
@@ -27,7 +27,7 @@ void Whirlpool::compress_n(const byte in[], size_t blocks)
for(size_t i = 0; i != blocks; ++i)
{
- load_be(&M[0], in, M.size());
+ load_be(M.data(), in, M.size());
u64bit K0, K1, K2, K3, K4, K5, K6, K7;
K0 = digest[0]; K1 = digest[1]; K2 = digest[2]; K3 = digest[3];