bitcoin-hs-0.0.1: Partial implementation of the Bitcoin protocol (as of 2013)

Bitcoin.Crypto.EC.Projective

Contents

Description

Using (weighted) projective coordinates on the curve we can maybe avoid the division bottleneck.

Based on: Chae Hoon Lim, Hyo Sun Hwang: Fast implementation of Elliptic Curve arithmetic in GF(p^n).

We will use (2,3,1) weighting, and a constant factor of 2 in Y:

x = X/Z^2
y = Y/(2*Z^3)
z = 1

Thus the curve equation y^2 = x^3 + 7 becomes

Y^2/4 = X^3 + 7*Z^6

and then the infinity point on the curve is (1,2,0).

Synopsis

# Documentation

data ECProj Source #

Note: the Eq instance is equality of all coordinates, not equality on the projective plane (for that, use "(=~=)" instead)

Constructors

 ECProj !Fp !Fp !Fp

Instances

 Source # Methods(==) :: ECProj -> ECProj -> Bool #(/=) :: ECProj -> ECProj -> Bool # Source # Methods(+) :: ECProj -> ECProj -> ECProj #(-) :: ECProj -> ECProj -> ECProj #(*) :: ECProj -> ECProj -> ECProj #abs :: ECProj -> ECProj # Source # MethodsshowsPrec :: Int -> ECProj -> ShowS #showList :: [ECProj] -> ShowS #

# Num/Eq instances

(=~=) :: ECProj -> ECProj -> Bool infix 4 Source #

Addition in the elliptic curve (or multiplication if you prefer to think it as a multiplicative group)

Doubling a point in the elliptic curve (multiplication by the integer 2)

Inverse (negation) in the elliptic curve

Multiplication by a positive integer (or exponentiation, if you think multiplicatively)