crypto-numbers-0.2.2: Cryptographic numbers: functions and algorithms

PortabilityGood
Stabilityexperimental
MaintainerDanny Navarro <j@dannynavarro.net>
Safe HaskellNone

Crypto.Number.F2m

Description

This module provides basic arithmetic operations over F₂m. Performance is not optimal and it doesn't provide protection against timing attacks. The m parameter is implicitly derived from the irreducible polynomial where applicable.

Synopsis

Documentation

addF2m :: Integer -> Integer -> IntegerSource

Addition over F₂m. This is just a synonym of xor.

mulF2mSource

Arguments

:: Integer

Irreducible binary polynomial

-> Integer 
-> Integer 
-> Integer 

Multiplication over F₂m.

squareF2mSource

Arguments

:: Integer

Irreducible binary polynomial

-> Integer 
-> Integer 

Squaring over F₂m. TODO: This is still slower than mulF2m.

modF2mSource

Arguments

:: Integer

Irreducible binary polynomial

-> Integer 
-> Integer 

Binary polynomial reduction modulo using long division algorithm.

invF2mSource

Arguments

:: Integer

Irreducible binary polynomial

-> Integer 
-> Maybe Integer 

Inversion over F₂m using extended Euclidean algorithm.

divF2mSource

Arguments

:: Integer

Irreducible binary polynomial

-> Integer

Dividend

-> Integer

Quotient

-> Maybe Integer 

Division over F₂m. If the dividend does't have an inverse it returns Nothing.