eccrypto-0.0.1: Elliptic Curve Cryptography for Haskell

Copyright(c) Marcel Fourné 20[09..14]
LicenseBSD3
MaintainerMarcel Fourné (haskell@marcelfourne.de)
Stabilitybeta
PortabilityGood
Safe HaskellNone
LanguageHaskell98

Crypto.ECC.NIST.Base

Description

ECC Base algorithms & point formats for NIST Curves as specified in NISTReCur.pdf[http:/csrc.nist.govgroupsSTtoolkitdocumentsdss/NISTReCur.pdf] Re Timing-Attacks: The field backends differ in timing-attack resistance. Due to the nature of NIST-curves, there are pitfalls in this module.

Synopsis

Documentation

type FPrime = Integer Source #

a simple wrapper to ease transition

data F2 Source #

F2 consist of an exact length of meaningful bits and a representation of those bits in a possibly larger Vector of Words | Note: The vectors use small to large indices, but the Data.Word endianness is of no concern as it is hidden by Data.Bits | This results in indices from 0 to l-1 mapped from left to right across Words | Be careful with those indices! The usage of quotRem with them has caused some headache.

Instances

Show F2 Source # 

Methods

showsPrec :: Int -> F2 -> ShowS #

show :: F2 -> String #

showList :: [F2] -> ShowS #

data EC a where Source #

all Elliptic Curves, the parameters being the BitLength L, A, B and P

Constructors

ECi :: Int -> FPrime -> FPrime -> FPrime -> EC FPrime 
ECb :: Int -> Int -> F2 -> F2 -> FPrime -> EC F2 

Instances

Eq (EC a) Source # 

Methods

(==) :: EC a -> EC a -> Bool #

(/=) :: EC a -> EC a -> Bool #

Show (EC a) Source # 

Methods

showsPrec :: Int -> EC a -> ShowS #

show :: EC a -> String #

showList :: [EC a] -> ShowS #

data ECPF a where Source #

data of Elliptic Curve Points

Constructors

ECPp :: FPrime -> FPrime -> FPrime -> ECPF FPrime 
ECPpF2 :: F2 -> F2 -> F2 -> ECPF F2 

Instances

Eq (ECPF a) Source # 

Methods

(==) :: ECPF a -> ECPF a -> Bool #

(/=) :: ECPF a -> ECPF a -> Bool #

Show (ECPF a) Source # 

Methods

showsPrec :: Int -> ECPF a -> ShowS #

show :: ECPF a -> String #

showList :: [ECPF a] -> ShowS #

affine :: EC a -> ECPF a -> (a, a) Source #

generic getter, returning the affine x and y-value

export :: EC a -> ECPF a -> (Integer, Integer) Source #

translate point in internal format to a pair of Integers in affine x and y coordinate | this is intended as interface to other libraries

padd :: EC a -> ECPF a -> ECPF a -> ECPF a Source #

add 2 elliptic points

pdouble :: EC a -> ECPF a -> ECPF a Source #

add an elliptic point onto itself, base for padd a a

pmul :: EC a -> ECPF a -> FPrime -> ECPF a Source #

Point Multiplication. The implementation is a montgomery ladder, which should be timing-attack-resistant (except for caches...)

ison :: EC a -> ECPF a -> Bool Source #

"generic" verify, if generic ECP is on EC via getxA and getyA