hash/blake2: use more const

This commit is contained in:
Danny Robson 2019-02-10 15:50:01 +11:00
parent bd940f0256
commit 1f3721ee15

View File

@ -75,21 +75,21 @@ G (
int const b, int const b,
int const c, int const c,
int const d, int const d,
word_t x, word_t const x,
word_t y word_t const y
) { ) {
v[a] = v[a] + v[b] + x; v[d] = cruft::rotater (v[d] ^ v[a], traits::rotations[0]); v[a] += v[b] + x; v[d] = cruft::rotater (v[d] ^ v[a], traits::rotations[0]);
v[c] = v[c] + v[d]; v[b] = cruft::rotater (v[b] ^ v[c], traits::rotations[1]); v[c] += v[d]; v[b] = cruft::rotater (v[b] ^ v[c], traits::rotations[1]);
v[a] = v[a] + v[b] + y; v[d] = cruft::rotater (v[d] ^ v[a], traits::rotations[2]); v[a] += v[b] + y; v[d] = cruft::rotater (v[d] ^ v[a], traits::rotations[2]);
v[c] = v[c] + v[d]; v[b] = cruft::rotater (v[b] ^ v[c], traits::rotations[3]); v[c] += v[d]; v[b] = cruft::rotater (v[b] ^ v[c], traits::rotations[3]);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// compression function // compression function
static void static void
F (std::array<word_t,8> &h, const word_t m[16], u64 t, bool const f) F (std::array<word_t,8> &h, const word_t m[16], u64 const t, bool const f)
{ {
std::array<word_t,16> v { std::array<word_t,16> v {
h[0], h[1], h[2], h[3], h[4], h[5], h[6], h[7], h[0], h[1], h[2], h[3], h[4], h[5], h[6], h[7],
@ -136,7 +136,7 @@ blake2::blake2 () noexcept:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
blake2::blake2 (cruft::view<const u08 *> key) blake2::blake2 (cruft::view<const u08 *> const key)
{ {
// don't give the user flexibility to provide too much key // don't give the user flexibility to provide too much key
if (key.size () > ::traits::max_key_bytes) if (key.size () > ::traits::max_key_bytes)