sqrti returns two integers (l,b) so that l <= sqrt i <= b.
The implementation is quite naive, use an approximation for the first number
and use a dichotomy algorithm to compute the bound relatively efficiently.
Modulecrypton-2.1.7Haskell2010
Crypto.Number.Basic
- 7 values
- Packagecrypton-2.1.7
- Exports7
- LanguageHaskell2010
- LicenceBSD-3-Clause AND MIT AND ISC
- SourceBasic.hs
Get the extended GCD of two integer using integer divMod
gcde a b find (x,y,gcd(a,b)) where ax + by = d
Check if a list of integer are all even
Compute the binary logarithm of a integer
Compute the number of bits for an integer
Compute the number of bytes for an integer
Out of numBits rather than out of GMP's own count in base 256. GHC's bignum sizes a number in base two by looking at its highest limb, and in any other base -- 256 included -- by dividing the number down to nothing: on a 2048-bit modulus that is 1.65 us against 0.01, and every serialization here asks for the size before it allocates. Eight bits to the byte does the rest.
Express an integer as an odd number and a power of 2