BigInt
Arbitrary precision integer
DivideByZero Exception
Create BigInt from any integer
T n | initial value of this BigInt |
Move constructor
Create BigInt from a string. If the string starts with 0x the rest of the string will be interpreted as hexadecimal digits. Otherwise, it will be interpreted as a decimal number.
string str | the string to parse for an integer value |
Create a BigInt from an integer in a ubyte array
const(ubyte)* input | the ubyte array holding the value |
size_t length | size of buf |
Base base | is the number base of the integer in buf |
Create a random BigInt of the specified size
RandomNumberGenerator rng | random number generator |
size_t bits | size in bits |
Create BigInt of specified size, all zeros
Sign s | the sign |
size_t size | of the internal register in words |
Move constructor
Move assignment
Copy assignment
Swap this value with another
BigInt other | BigInt to swap values with |
+= operator
BigInt y | the BigInt to add to this |
-= operator
BigInt y | the BigInt to subtract from this |
*= operator
BigInt y | the BigInt to multiply with this |
/= operator
BigInt y | the BigInt to divide this by |
Modulo operator
BigInt mod | the modulus to reduce this by |
Modulo operator
word mod | the modulus (word) to reduce this by |
Left shift operator
size_t shift | the number of bits to shift this left by |
Right shift operator
size_t shift | the number of bits to shift this right by |
Increment operator
Decrement operator
Unary negation operator
bool cast
Zeroize the BigInt. The size of the underlying register is not modified.
Compare this to another BigInt
BigInt other | the BigInt value to compare with |
bool check_signs | include sign in comparison? |
Test if the integer has an even value
Test if the integer has an odd value
Test if the integer is not zero
Test if the integer is zero
Set bit at specified position
size_t n | bit position to set |
Clear bit at specified position
size_t n | bit position to clear |
Clear all but the lowest n bits
size_t n | amount of bits to keep |
Return bit value at specified position
size_t n | the bit offset to test |
Return (a maximum of) 32 bits of the complete value
size_t offset | the offset to start extracting |
size_t length | amount of bits to extract (starting at offset) |
Convert this value into a uint, if it is in the range [0 ... 2**32-1], or otherwise throw new an exception.
size_t n | the offset to get a ubyte from |
Return the word at a specified position of the internal register
size_t n | position in the register |
Tests if the sign of the integer is negative
Tests if the sign of the integer is positive
Flip the sign of this BigInt
Set sign of the integer
Sign s | new Sign to set |
Return how many words we need to hold this value
Give ubyte length of the integer
Get the bit length of the integer
Return a mutable pointer to the register
Return a const pointer to the register
Increase internal register buffer to at least n words
size_t n | new size of register |
Fill BigInt with a random number with size of bitsize
RandomNumberGenerator rng | the random number generator to use |
size_t bitsize | number of bits the created random value should have |
Store BigInt-value in a given ubyte array
ubyte* output | destination ubyte array for the integer value |
Read integer value from a ubyte array with given size
const(ubyte)* buf | ubyte array buffer containing the integer |
size_t length | size of buf |
Read integer value from a ubyte array (SecureVector!ubyte)
Vector!(ubyte, ALLOC) buf | the array to load from |
Base base | the base to measure the size for |
RandomNumberGenerator rng | a random number generator |
BigInt min | the minimum value |
BigInt max | the maximum value |
Create a power of two
size_t n | the power of two to create |
Encode the integer value from a BigInt to an Array of bytes
BigInt n | the BigInt to use as integer source |
Base base | number-base of resulting ubyte array representation |
Encode the integer value from a BigInt to a Secure Array of bytes
BigInt n | the BigInt to use as integer source |
Base base | number-base of resulting ubyte array representation |
Encode the integer value from a BigInt to a ubyte array
ubyte* output | destination ubyte array for the encoded integer value with given base |
BigInt n | the BigInt to use as integer source |
Base base | number-base of resulting ubyte array representation |
Create a BigInt from an integer in a ubyte array
const(ubyte)* buf | the binary value to load |
size_t length | size of buf |
Base base | number-base of the integer in buf |
Create a BigInt from an integer in a ubyte array
RefCounted!(Vector!(ubyte, ALLOC), ALLOC) buf | the binary value to load |
Base base | number-base of the integer in buf |
Create a BigInt from an integer in a ubyte array
Vector!(ubyte, ALLOC) buf | the binary value to load |
Base base | number-base of the integer in buf |
Encode a BigInt to a ubyte array according to IEEE 1363
BigInt n | the BigInt to encode |
size_t bytes | the length of the resulting SecureVector!ubyte |