aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2007-03-01 01:22:13 +0000
committerlloyd <[email protected]>2007-03-01 01:22:13 +0000
commit758974e833aca9cd7403fd1835efd84e6e861d3a (patch)
tree269eb8e447b1b93c82a18ed8aea371cd0968920c
parentafcd75d5f60be62e7a9dfc8e1a1cda3fc3d0762e (diff)
Add a version of BigInt::binary_decode taking a MemoryRegion of bytes
-rw-r--r--include/bigint.h1
-rw-r--r--src/big_base.cpp8
2 files changed, 9 insertions, 0 deletions
diff --git a/include/bigint.h b/include/bigint.h
index 2fab6645c..44382b063 100644
--- a/include/bigint.h
+++ b/include/bigint.h
@@ -86,6 +86,7 @@ class BigInt
void binary_encode(byte[]) const;
void binary_decode(const byte[], u32bit);
+ void binary_decode(const MemoryRegion<byte>&);
u32bit encoded_size(Base = Binary) const;
static SecureVector<byte> encode(const BigInt&, Base = Binary);
diff --git a/src/big_base.cpp b/src/big_base.cpp
index 20d6f4ece..158d967fb 100644
--- a/src/big_base.cpp
+++ b/src/big_base.cpp
@@ -375,4 +375,12 @@ void BigInt::binary_decode(const byte buf[], u32bit length)
reg[length / WORD_BYTES] = (reg[length / WORD_BYTES] << 8) | buf[j];
}
+/*************************************************
+* Set this number to the value in buf *
+*************************************************/
+void BigInt::binary_decode(const MemoryRegion<byte>& buf)
+ {
+ binary_decode(buf, buf.size());
+ }
+
}