aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/base/buf_comp.h
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-05-19 16:57:58 -0400
committerJack Lloyd <[email protected]>2019-05-27 21:42:04 -0400
commit1d283a6f9e995d750b6d1801b5b64186d8b56f7b (patch)
tree0b4fa7a900dcac740c0a6d123af4c3a9c85953f8 /src/lib/base/buf_comp.h
parent0dd03c973f6c9ae6a38118385c82e64154e465f3 (diff)
Add Argon2
Closes GH #459
Diffstat (limited to 'src/lib/base/buf_comp.h')
-rw-r--r--src/lib/base/buf_comp.h19
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));
}
/**