hF2-0.2: F(2^e) math for cryptography

PortabilityGood
Stabilityexperimental
MaintainerMarcel Fourné (mail@marcelfourne.de)
Safe HaskellNone

Data.F2

Description

A hopefully timing attack resistant F(2^e) backend, i.e. binary representation polynomial arithmetic The presented interface is Big Endian, like Data.Bits All indices are [0 .. (length - 1)] TODO: further optimization

Synopsis

Documentation

data F2 Source

F2 consist of an exact length of meaningful bits an 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

Instances

powSource

Arguments

:: F2

a

-> Integer

k

-> F2

a^k

The power function on F2

toInteger :: F2 -> IntegerSource

conversion to Integer

even :: F2 -> BoolSource

O(1), a simple Test for the LSB

odd :: F2 -> BoolSource

O(1), a simple Test for the LSB

modSource

Arguments

:: F2

a

-> F2

b

-> F2

a mod b

Polynomial reduction, a.k.a. modulo on polynomials

divSource

Arguments

:: F2

k

-> F2

f

-> F2

m

-> F2

k/f mod m

Polynomial division, needs 3 parameters instead of 2, computing k/f mod m by binary inversion of f in m

bininvSource

Arguments

:: F2

f

-> F2

m

-> F2 

binary inversion of f in m