Copyright | (c) 2018 Bhavik Mehta |
---|---|
License | MIT |
Maintainer | Andrew Lelechenko <andrew.lelechenko@gmail.com> |
Safe Haskell | None |
Language | Haskell2010 |
Deprecated: Use Math.NumberTheory.Moduli.Multiplicative instead
Description: Deprecated
Synopsis
- discreteLogarithm :: CyclicGroup Integer m -> PrimitiveRoot m -> MultMod m -> Natural
Documentation
discreteLogarithm :: CyclicGroup Integer m -> PrimitiveRoot m -> MultMod m -> Natural Source #
Computes the discrete logarithm. Currently uses a combination of the baby-step giant-step method and Pollard's rho algorithm, with Bach reduction.
>>>
:set -XDataKinds
>>>
import Data.Maybe
>>>
let cg = fromJust cyclicGroup :: CyclicGroup Integer 13
>>>
let rt = fromJust (isPrimitiveRoot cg 2)
>>>
let x = fromJust (isMultElement 11)
>>>
discreteLogarithm cg rt x
7