eccrypto-0.0.1: Elliptic Curve Cryptography for Haskell

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

Crypto.F2

Description

Functions for F_{2^{E}} Re Timing-Attacks: We depend on (==) being resistant for Integer. This backend is faulty and slow.

Synopsis

Documentation

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.

Constructors

F2 !Int !(Vector Word) 

Instances

Show F2 Source # 

Methods

showsPrec :: Int -> F2 -> ShowS #

show :: F2 -> String #

showList :: [F2] -> ShowS #

eq :: F2 -> F2 -> Bool Source #

(==) on F2

add :: F2 -> F2 -> F2 Source #

(+) on F2

addr :: F2 -> F2 -> F2 -> F2 Source #

(+) on F2 modulo p

shift :: F2 -> Int -> F2 Source #

shift on F2

mul :: F2 -> F2 -> F2 Source #

(*) on F2 peasants algorithm

mulr :: F2 -> F2 -> F2 -> F2 Source #

(*) on F2, reduced to stay in the field

testBit :: F2 -> Int -> Bool Source #

testBit on F2

redc :: F2 -> F2 -> F2 Source #

polynomial reduction, simple scan TODO: idempotent? not right now -> ERROR!

square :: F2 -> F2 Source #

squaring on F2 TODO: optimize

pow :: (Bits a, Integral a) => F2 -> F2 -> a -> F2 Source #

the power function on F2 for positive exponents, reducing early

inv :: F2 -> F2 -> F2 Source #

inversion of F2 in the field

fromInteger :: Int -> Integer -> F2 Source #

this is a chunked converter from Integer into eccrypto native format TODO: implement low-level Integer conversion?

toInteger :: F2 -> Integer Source #

this is a chunked converter from eccrypto native format into Integer TODO: implement low-level Integer conversion?