cryptonite-0.27: Cryptography Primitives sink

LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilityexperimental
PortabilityGood
Safe HaskellNone
LanguageHaskell2010

Crypto.Number.Basic

Description

 
Synopsis

Documentation

sqrti :: Integer -> (Integer, Integer) Source #

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.

gcde :: Integer -> Integer -> (Integer, Integer, Integer) Source #

Get the extended GCD of two integer using integer divMod

gcde a b find (x,y,gcd(a,b)) where ax + by = d

areEven :: [Integer] -> Bool Source #

Check if a list of integer are all even

log2 :: Integer -> Int Source #

Compute the binary logarithm of a integer

numBits :: Integer -> Int Source #

Compute the number of bits for an integer

numBytes :: Integer -> Int Source #

Compute the number of bytes for an integer

asPowerOf2AndOdd :: Integer -> (Int, Integer) Source #

Express an integer as an odd number and a power of 2