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

Safe HaskellSafe
LanguageHaskell98

Bitcoin.Crypto.FiniteField.Naive.Fn

Contents

Description

The finite field Fn of n elements, where n is the order of the elliptic curve secp256k1 (which happens to be a prime).

Naive implementation.

Synopsis

Documentation

for the signatures, we also need mod n arithmetic, not only mod p...

newtype Fn Source #

The prime field Fn (n seems to be a prime, after all)

Constructors

Fn Integer 

Instances

Eq Fn Source # 

Methods

(==) :: Fn -> Fn -> Bool #

(/=) :: Fn -> Fn -> Bool #

Fractional Fn Source # 

Methods

(/) :: Fn -> Fn -> Fn #

recip :: Fn -> Fn #

fromRational :: Rational -> Fn #

Num Fn Source # 

Methods

(+) :: Fn -> Fn -> Fn #

(-) :: Fn -> Fn -> Fn #

(*) :: Fn -> Fn -> Fn #

negate :: Fn -> Fn #

abs :: Fn -> Fn #

signum :: Fn -> Fn #

fromInteger :: Integer -> Fn #

Show Fn Source # 

Methods

showsPrec :: Int -> Fn -> ShowS #

show :: Fn -> String #

showList :: [Fn] -> ShowS #

pow_n :: Fn -> Fn -> Fn Source #

modn :: Integer -> Integer Source #

helper function: Modulo n

invFn :: Integer -> Integer Source #

Multiplicative inverse in Fp

powFn :: Integer -> Integer -> Integer Source #

(Fast) exponentiation in Fn