diff options
author | Jack Lloyd <[email protected]> | 2018-05-19 16:57:58 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-05-27 21:42:04 -0400 |
commit | 1d283a6f9e995d750b6d1801b5b64186d8b56f7b (patch) | |
tree | 0b4fa7a900dcac740c0a6d123af4c3a9c85953f8 /src/lib/base/buf_comp.h | |
parent | 0dd03c973f6c9ae6a38118385c82e64154e465f3 (diff) |
Add Argon2
Closes GH #459
Diffstat (limited to 'src/lib/base/buf_comp.h')
-rw-r--r-- | src/lib/base/buf_comp.h | 19 |
1 files changed, 14 insertions, 5 deletions
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<typename T> 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<typename T> void update_le(const T in) + { + uint8_t inb[sizeof(T)]; + store_le(in, inb); + add_data(inb, sizeof(inb)); } /** |