diff options
author | lloyd <[email protected]> | 2010-09-13 15:54:50 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-09-13 15:54:50 +0000 |
commit | 36bfef27271eadffefbc6891a9d7fa7eed7b1e10 (patch) | |
tree | 81fe9b37bb580cedba5bb25ac04dfecdd36b18de /src/hash/md2/md2.cpp | |
parent | 4a7e9edcc92b08a285ea24549fd8c813d10b63b9 (diff) |
More vector->pointer conversion removals.
Add RandomNumberGenerator::random_vec, which takes an length n and
returns a new SecureVector with randomized contents of that size. This
nicely covers most of the cases where randomize was being called on a
vector, and is a little cleaner in the code as well, instead of
vec.resize(length);
rng.randomize(&vec[0], vec.size());
we just write
vec = rng.random_vec(length);
Diffstat (limited to 'src/hash/md2/md2.cpp')
-rw-r--r-- | src/hash/md2/md2.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/hash/md2/md2.cpp b/src/hash/md2/md2.cpp index 376a95e93..462e43b25 100644 --- a/src/hash/md2/md2.cpp +++ b/src/hash/md2/md2.cpp @@ -40,7 +40,7 @@ void MD2::hash(const byte input[]) 0x9F, 0x11, 0x83, 0x14 }; X.copy(16, input, HASH_BLOCK_SIZE); - xor_buf(X + 32, X, X + 16, HASH_BLOCK_SIZE); + xor_buf(&X[32], &X[0], &X[16], HASH_BLOCK_SIZE); byte T = 0; for(u32bit j = 0; j != 18; ++j) { @@ -88,8 +88,8 @@ void MD2::final_result(byte output[]) { for(u32bit j = position; j != HASH_BLOCK_SIZE; ++j) buffer[j] = static_cast<byte>(HASH_BLOCK_SIZE - position); - hash(buffer); - hash(checksum); + hash(&buffer[0]); + hash(&checksum[0]); copy_mem(output, &X[0], OUTPUT_LENGTH); clear(); } |