From c0e1e0b7b68e4419f1ed655877f9f9bcd776d6c6 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Mon, 4 Feb 2019 20:00:44 +1100 Subject: [PATCH] hash/md2: prefer cruft::std types --- hash/md2.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hash/md2.cpp b/hash/md2.cpp index 8778dc2..eb3d43f 100644 --- a/hash/md2.cpp +++ b/hash/md2.cpp @@ -8,6 +8,7 @@ #include "md2.hpp" +#include #include #include @@ -21,7 +22,7 @@ using cruft::crypto::hash::MD2; /////////////////////////////////////////////////////////////////////////////// -static constexpr std::array S = { { +static constexpr std::array S = { { 41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6, 19, 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188, 76, 130, 202, 30, 155, 87, 60, 253, 212, 224, 22, 103, 66, 111, 24, 138, 23, 229, 18, @@ -48,7 +49,7 @@ static const size_t M_LENGTH = 16; /////////////////////////////////////////////////////////////////////////////// static void -transform (std::array &C, std::array &X) noexcept +transform (std::array &C, std::array &X) noexcept { cruft::view M { X.data () + M_OFFSET, M_LENGTH }; @@ -56,7 +57,7 @@ transform (std::array &C, std::array &X) noexcept // XXX: I can't see why we need the xor-assign from the spec, but it's the // only change keeping us from conforming to the test-cases. Pulled from a // review of the reference implementation. - uint8_t L = C[15]; + u08 L = C[15]; for (size_t i = 0; i < std::size (C); ++i) L = C[i] ^= S[M[i] ^ L]; @@ -77,12 +78,12 @@ transform (std::array &C, std::array &X) noexcept /////////////////////////////////////////////////////////////////////////////// MD2::digest_t -MD2::operator() (const cruft::view data) const noexcept +MD2::operator() (const cruft::view data) const noexcept { // zero initialise the state vectors, and create a simple window `M' into // the middle of the `X' state vector. - std::array C {}; - std::array X {}; + std::array C {}; + std::array X {}; const cruft::view M { std::begin (X) + M_OFFSET, M_LENGTH }; // process each complete block by copying to the window `M' and