From 1d283a6f9e995d750b6d1801b5b64186d8b56f7b Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Sat, 19 May 2018 16:57:58 -0400 Subject: Add Argon2 Closes GH #459 --- src/lib/base/buf_comp.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src/lib/base/buf_comp.h') diff --git a/src/lib/base/buf_comp.h b/src/lib/base/buf_comp.h index a6cc84ba3..e1971c458 100644 --- a/src/lib/base/buf_comp.h +++ b/src/lib/base/buf_comp.h @@ -57,11 +57,20 @@ class BOTAN_PUBLIC_API(2,0) Buffered_Computation */ template void update_be(const T in) { - for(size_t i = 0; i != sizeof(T); ++i) - { - uint8_t b = get_byte(i, in); - add_data(&b, 1); - } + uint8_t inb[sizeof(T)]; + store_be(in, inb); + add_data(inb, sizeof(inb)); + } + + /** + * Add an integer in little-endian order + * @param in the value + */ + template void update_le(const T in) + { + uint8_t inb[sizeof(T)]; + store_le(in, inb); + add_data(inb, sizeof(inb)); } /** -- cgit v1.2.3