aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/math/bigint/bigint.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/math/bigint/bigint.h')
-rw-r--r--src/lib/math/bigint/bigint.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/lib/math/bigint/bigint.h b/src/lib/math/bigint/bigint.h
index d866698b3..776884ad9 100644
--- a/src/lib/math/bigint/bigint.h
+++ b/src/lib/math/bigint/bigint.h
@@ -74,11 +74,15 @@ class BOTAN_DLL BigInt
BigInt(const byte buf[], size_t length, Base base = Binary);
/**
- * Create a random BigInt of the specified size
+ * \brief Create a random BigInt of the specified size
+ *
* @param rng random number generator
* @param bits size in bits
+ * @param set_high_bit if true, the highest bit is always set
+ *
+ * @see randomize
*/
- BigInt(RandomNumberGenerator& rng, size_t bits);
+ BigInt(RandomNumberGenerator& rng, size_t bits, bool set_high_bit = true);
/**
* Create BigInt of specified size, all zeros
@@ -431,10 +435,16 @@ class BOTAN_DLL BigInt
/**
* Fill BigInt with a random number with size of bitsize
+ *
+ * If \p set_high_bit is true, the highest bit will be set, which causes
+ * the entropy to be \a bits-1. Otherwise the highest bit is randomly choosen
+ * by the rng, causing the entropy to be \a bits.
+ *
* @param rng the random number generator to use
* @param bitsize number of bits the created random value should have
+ * @param set_high_bit if true, the highest bit is always set
*/
- void randomize(RandomNumberGenerator& rng, size_t bitsize = 0);
+ void randomize(RandomNumberGenerator& rng, size_t bitsize, bool set_high_bit = true);
/**
* Store BigInt-value in a given byte array