HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Modulecryptonite-0.30Haskell2010

Crypto.PubKey.ECC.Prim

Elliptic Curve Arithmetic.

WARNING: These functions are vulnerable to timing attacks.

Synopsis
  • Packagecryptonite-0.30
  • Exports9
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourcePrim.hs
valuepointDouble :: Curve -> Point -> Point

Elliptic Curve point doubling.

WARNING: Vulnerable to timing attacks.

This perform the following calculation: > lambda = (3 * xp ^ 2 + a) / 2 yp > xr = lambda ^ 2 - 2 xp > yr = lambda (xp - xr) - yp

With binary curve: > xp == 0 => P = O > otherwise => > s = xp + (yp / xp) > xr = s ^ 2 + s + a > yr = xp ^ 2 + (s+1) * xr

valueisPointValid :: Curve -> Point -> Bool

check if a point is on specific curve

This perform three checks:

  • x is not out of range

  • y is not out of range

  • the equation y^2 = x^3 + a*x + b (mod p) holds