crypto-numbers-0.2.7: Cryptographic numbers: functions and algorithms

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Stability | experimental
Portability | Good
Safe Haskell | None
Language | Haskell98

Crypto.Number.Basic

Description

Synopsis

- sqrti :: Integer -> (Integer, Integer)
- gcde :: Integer -> Integer -> (Integer, Integer, Integer)
- gcde_binary :: Integer -> Integer -> (Integer, Integer, Integer)
- areEven :: [Integer] -> Bool
- log2 :: Integer -> Int

# Documentation

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

sqrti returns two integer (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) #

get the extended GCD of two integer using integer divMod

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

gcde_binary :: Integer -> Integer -> (Integer, Integer, Integer) #

get the extended GCD of two integer using the extended binary algorithm (HAC 14.61) get (x,y,d) where d = gcd(a,b) and x,y satisfying ax + by = d

areEven :: [Integer] -> Bool #

check if a list of integer are all even

log2 :: Integer -> Int #