mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-19 13:27:35 +02:00
refactor: Replace &foo[0] with foo.data()
This commit is contained in:
parent
faece47c47
commit
fac30eec42
15 changed files with 40 additions and 40 deletions
|
|
@ -33,7 +33,7 @@ static void TestVector(const Hasher &h, const In &in, const Out &out) {
|
|||
hash.resize(out.size());
|
||||
{
|
||||
// Test that writing the whole input string at once works.
|
||||
Hasher(h).Write((unsigned char*)&in[0], in.size()).Finalize(&hash[0]);
|
||||
Hasher(h).Write((const uint8_t*)in.data(), in.size()).Finalize(hash.data());
|
||||
BOOST_CHECK(hash == out);
|
||||
}
|
||||
for (int i=0; i<32; i++) {
|
||||
|
|
@ -42,15 +42,15 @@ static void TestVector(const Hasher &h, const In &in, const Out &out) {
|
|||
size_t pos = 0;
|
||||
while (pos < in.size()) {
|
||||
size_t len = InsecureRandRange((in.size() - pos + 1) / 2 + 1);
|
||||
hasher.Write((unsigned char*)&in[pos], len);
|
||||
hasher.Write((const uint8_t*)in.data() + pos, len);
|
||||
pos += len;
|
||||
if (pos > 0 && pos + 2 * out.size() > in.size() && pos < in.size()) {
|
||||
// Test that writing the rest at once to a copy of a hasher works.
|
||||
Hasher(hasher).Write((unsigned char*)&in[pos], in.size() - pos).Finalize(&hash[0]);
|
||||
Hasher(hasher).Write((const uint8_t*)in.data() + pos, in.size() - pos).Finalize(hash.data());
|
||||
BOOST_CHECK(hash == out);
|
||||
}
|
||||
}
|
||||
hasher.Finalize(&hash[0]);
|
||||
hasher.Finalize(hash.data());
|
||||
BOOST_CHECK(hash == out);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue