eccrypto-0.0.1: Elliptic Curve Cryptography for Haskell

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

Crypto.ECC.Ed25519.EdDSA

Description

Long-time plan: get rid of Integer and do all field arithmetic const-time by hand

Synopsis

Documentation

b :: Int Source #

working on exactly 256 bits

q :: FPrime Source #

the large prime

l :: FPrime Source #

curve parameter l

d :: FPrime Source #

curve parameter d

i :: FPrime Source #

sqrt (-1) on our curve

h :: ByteString -> ByteString Source #

wrapper for our hash function

by :: FPrime Source #

the y coordinate of the base point of the curve

null :: FPrime Source #

special form of FPrime, no bits set

eins :: FPrime Source #

special form of FPrime, lowest bit set

alleeins :: FPrime Source #

special form of FPrime, all bits set

xrecover :: FPrime -> Integer -> FPrime Source #

recover the x coordinate from the y coordinate and a signum

listofbits :: FPrime -> [FPrime] Source #

convert a FPrime to a list of FPrimes, each 0 or 1 depending on the inputs bits

bPoint :: Point Source #

base point on the curve

padd :: Point -> Point -> Point Source #

scalar addition

pmul :: Point -> FPrime -> Point Source #

scalar multiplication, branchfree in k, pattern-matched branch on j (length of k)

ison :: Point -> Bool Source #

check if Point is on the curve, prevents some attacks

getFPrime :: Get FPrime Source #

converts 32 little endian bytes into one FPrime

putFPrime :: FPrime -> Put Source #

converts one FPrime into exactly 32 little endian bytes

pointtobs :: Point -> ByteString Source #

convert a point on the curve to a ByteString

bstopoint :: ByteString -> Either String Point Source #

convert a ByteString to a point on the curve

keyPoint :: SecFPrime -> PubKeyPoint Source #

multiply the curve base point by a FPrime, giving a point on the curve

data Point Source #

Constructors

Point (FPrime, FPrime) 

Instances

Eq Point Source # 

Methods

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

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

Show Point Source # 

Methods

showsPrec :: Int -> Point -> ShowS #

show :: Point -> String #

showList :: [Point] -> ShowS #

genkeys_simple :: IO (Either String (SecKey, PubKey)) Source #

generate a new key pair (secret and derived public key) using some external entropy

genkeys :: CryptoRandomGen g => g -> Either String (SecKey, PubKey) Source #

generate a new key pair (secret and derived public key) using the supplied randomness-generator

sign :: SecKey -> Message -> Either String Signature Source #

sign with secret key the message, resulting in message appended to the signature

sign_detached :: SecKey -> Message -> Either String Signature Source #

sign with secret key the message, resulting in a detached signature