Safe Haskell | None |
---|---|
Language | Haskell98 |
The secp256k1
Elliptic Curve.
At the moment somewhat slow :(
References:
- data ECPoint
- = ECPoint !Fp !Fp
- | ECInfinity
- mkECPoint :: Integer -> Integer -> ECPoint
- isECOnCurve :: ECPoint -> Bool
- secp256k1_p :: Integer
- secp256k1_a :: Integer
- secp256k1_b :: Integer
- secp256k1_Gx :: Integer
- secp256k1_Gy :: Integer
- secp256k1_n :: Integer
- secp256k1_h :: Integer
- secp256k1_G :: ECPoint
- addEC :: ECPoint -> ECPoint -> ECPoint
- subEC :: ECPoint -> ECPoint -> ECPoint
- dblEC :: ECPoint -> ECPoint
- invEC :: ECPoint -> ECPoint
- mulEC :: ECPoint -> Integer -> ECPoint
Documentation
A point on the elliptic curve secp256k1
ECPoint !Fp !Fp | a "regular" element of the elliptic curve |
ECInfinity | the point at infinity is the unit element |
isECOnCurve :: ECPoint -> Bool Source #
secp256k1 curve parameters.
secp256k1_p :: Integer Source #
Parameters of the secp256k1 elliptic curve.
- p is the order of the prime field we are working over
- a and b are the parameters in the curve equation
y^2 = x^3 + a*x + b
(buta=0
here) - G is the generator of the subgroup in the curve
- n is the order of G, equivalently the size of the subgroup
- H is the cofactor (size of the curve divided by the size of the subgroup)
secp256k1_G :: ECPoint Source #
G is the base point, that is the generator; E = { G^i | iin Z } = { G^i | i<-[1..n] }
Operations on the secp256k1 curve
addEC :: ECPoint -> ECPoint -> ECPoint Source #
Addition in the elliptic curve (or multiplication if you prefer to think it as a multiplicative group)
dblEC :: ECPoint -> ECPoint Source #
Doubling a point in the elliptic curve (multiplication by the integer 2)
mulEC :: ECPoint -> Integer -> ECPoint Source #
Multiplication by a positive integer (or exponentiation, if you think multiplicatively). This is slow, use the projective version instead!