diff options
Diffstat (limited to 'src/lib/math/bigint/big_code.cpp')
-rw-r--r-- | src/lib/math/bigint/big_code.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lib/math/bigint/big_code.cpp b/src/lib/math/bigint/big_code.cpp index 228edb51a..d71e57849 100644 --- a/src/lib/math/bigint/big_code.cpp +++ b/src/lib/math/bigint/big_code.cpp @@ -81,15 +81,20 @@ secure_vector<byte> BigInt::encode_locked(const BigInt& n, Base base) */ secure_vector<byte> BigInt::encode_1363(const BigInt& n, size_t bytes) { + secure_vector<byte> output(bytes); + encode_1363(&output[0], output.size(), n); + return output; + } + +//static +void BigInt::encode_1363(byte output[], size_t bytes, const BigInt& n) + { const size_t n_bytes = n.bytes(); if(n_bytes > bytes) throw Encoding_Error("encode_1363: n is too large to encode properly"); const size_t leading_0s = bytes - n_bytes; - - secure_vector<byte> output(bytes); encode(&output[leading_0s], n, Binary); - return output; } /* |