diff options
author | Jack Lloyd <[email protected]> | 2018-03-21 02:52:11 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-03-21 02:52:11 -0400 |
commit | 66e92c60eb5dff1b32995b2692594f8708c5c029 (patch) | |
tree | b5b74a838422fa32d0f2c7e56ae2299a50344d81 /src/lib/math | |
parent | c22fc530382acb28c3d747baf5eef8f44059182a (diff) |
Simplify a common case BigInt constructor
Diffstat (limited to 'src/lib/math')
-rw-r--r-- | src/lib/math/bigint/bigint.cpp | 5 | ||||
-rw-r--r-- | src/lib/math/bigint/bigint.h | 9 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/lib/math/bigint/bigint.cpp b/src/lib/math/bigint/bigint.cpp index a42707e07..694c7afab 100644 --- a/src/lib/math/bigint/bigint.cpp +++ b/src/lib/math/bigint/bigint.cpp @@ -80,6 +80,11 @@ BigInt::BigInt(const std::string& str) else set_sign(Positive); } +BigInt::BigInt(const uint8_t input[], size_t length) + { + binary_decode(input, length); + } + /* * Construct a BigInt from an encoded BigInt */ diff --git a/src/lib/math/bigint/bigint.h b/src/lib/math/bigint/bigint.h index 3f0eb8523..56b907d80 100644 --- a/src/lib/math/bigint/bigint.h +++ b/src/lib/math/bigint/bigint.h @@ -74,9 +74,16 @@ class BOTAN_PUBLIC_API(2,0) BigInt final * Create a BigInt from an integer in a byte array * @param buf the byte array holding the value * @param length size of buf + */ + BigInt(const uint8_t buf[], size_t length); + + /** + * Create a BigInt from an integer in a byte array + * @param buf the byte array holding the value + * @param length size of buf * @param base is the number base of the integer in buf */ - BigInt(const uint8_t buf[], size_t length, Base base = Binary); + BigInt(const uint8_t buf[], size_t length, Base base); /** * Create a BigInt from an array of words |