Safe Haskell | None |
---|---|
Language | Haskell2010 |
Elliptic Curve Arithmetic.
WARNING: These functions are vulnerable to timing attacks.
- scalarGenerate :: MonadRandom randomly => Curve -> randomly PrivateNumber
- pointAdd :: Curve -> Point -> Point -> Point
- pointDouble :: Curve -> Point -> Point
- pointBaseMul :: Curve -> Integer -> Point
- pointMul :: Curve -> Integer -> Point -> Point
- isPointAtInfinity :: Point -> Bool
- isPointValid :: Curve -> Point -> Bool
Documentation
scalarGenerate :: MonadRandom randomly => Curve -> randomly PrivateNumber Source
pointAdd :: Curve -> Point -> Point -> Point Source
Elliptic Curve point addition.
WARNING: Vulnerable to timing attacks.
pointDouble :: Curve -> Point -> Point Source
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
pointBaseMul :: Curve -> Integer -> Point Source
Elliptic curve point multiplication using the base
WARNING: Vulnerable to timing attacks.
pointMul :: Curve -> Integer -> Point -> Point Source
Elliptic curve point multiplication (double and add algorithm).
WARNING: Vulnerable to timing attacks.
isPointAtInfinity :: Point -> Bool Source
Check if a point is the point at infinity.
isPointValid :: Curve -> Point -> Bool Source
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