eccrypto-0.0.1: Elliptic Curve Cryptography for Haskell

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

 Source # MethodsshowsPrec :: 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!

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

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

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