aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/algo_base/symkey.cpp8
-rw-r--r--src/algo_base/symkey.h29
2 files changed, 11 insertions, 26 deletions
diff --git a/src/algo_base/symkey.cpp b/src/algo_base/symkey.cpp
index 56648d9c5..a84ce2f19 100644
--- a/src/algo_base/symkey.cpp
+++ b/src/algo_base/symkey.cpp
@@ -26,7 +26,7 @@ OctetString::OctetString(RandomNumberGenerator& rng,
/*
* Create an OctetString from a hex string
*/
-void OctetString::change(const std::string& hex_string)
+OctetString::OctetString(const std::string& hex_string)
{
bits.resize(1 + hex_string.length() / 2);
bits.resize(hex_decode(&bits[0], hex_string));
@@ -35,12 +35,16 @@ void OctetString::change(const std::string& hex_string)
/*
* Create an OctetString from a byte string
*/
-void OctetString::change(const byte in[], size_t n)
+OctetString::OctetString(const byte in[], size_t n)
{
bits.resize(n);
bits.copy(in, n);
}
+OctetString::OctetString(const MemoryRegion<byte>& b) : bits(b)
+ {
+ }
+
/*
* Set the parity of each key byte to odd
*/
diff --git a/src/algo_base/symkey.h b/src/algo_base/symkey.h
index 6735b2b87..2ccc0b883 100644
--- a/src/algo_base/symkey.h
+++ b/src/algo_base/symkey.h
@@ -57,23 +57,10 @@ class BOTAN_DLL OctetString
void set_odd_parity();
/**
- * Change the contents of this octet string
- * @param hex_string a hex encoded bytestring
- */
- void change(const std::string& hex_string);
-
- /**
- * Change the contents of this octet string
- * @param in the input
- * @param length of in in bytes
- */
- void change(const byte in[], size_t length);
-
- /**
- * Change the contents of this octet string
- * @param in the input
+ * Create a new OctetString
+ * @param str is a hex encoded string
*/
- void change(const MemoryRegion<byte>& in) { bits = in; }
+ OctetString(const std::string& str = "");
/**
* Create a new random OctetString
@@ -84,22 +71,16 @@ class BOTAN_DLL OctetString
/**
* Create a new OctetString
- * @param str is a hex encoded string
- */
- OctetString(const std::string& str = "") { change(str); }
-
- /**
- * Create a new OctetString
* @param in is an array
* @param len is the length of in in bytes
*/
- OctetString(const byte in[], size_t len) { change(in, len); }
+ OctetString(const byte in[], size_t len);
/**
* Create a new OctetString
* @param in a bytestring
*/
- OctetString(const MemoryRegion<byte>& in) { change(in); }
+ OctetString(const MemoryRegion<byte>& in);
private:
SecureVector<byte> bits;
};