| License | BSD-style |
|---|---|
| Maintainer | Danny Navarro <j@dannynavarro.net> |
| Stability | experimental |
| Portability | Good |
| Safe Haskell | None |
| Language | Haskell2010 |
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.
- type BinaryPolynomial = Integer
- addF2m :: Integer -> Integer -> Integer
- mulF2m :: BinaryPolynomial -> Integer -> Integer -> Integer
- squareF2m :: BinaryPolynomial -> Integer -> Integer
- modF2m :: BinaryPolynomial -> Integer -> Integer
- invF2m :: BinaryPolynomial -> Integer -> Maybe Integer
- divF2m :: BinaryPolynomial -> Integer -> Integer -> Maybe Integer
Documentation
type BinaryPolynomial = Integer Source
Binary Polynomial represented by an integer
Arguments
| :: BinaryPolynomial | Irreducible binary polynomial |
| -> Integer | |
| -> Integer | |
| -> Integer |
Multiplication over F₂m.
n1 * n2 (in F(2^m))
Arguments
| :: BinaryPolynomial | Irreducible binary polynomial |
| -> Integer | |
| -> Integer |
Squaring over F₂m.
TODO: This is still slower than mulF2m.
Arguments
| :: BinaryPolynomial | Irreducible binary polynomial |
| -> Integer | |
| -> Integer |
Binary polynomial reduction modulo using long division algorithm.
Arguments
| :: BinaryPolynomial | Irreducible binary polynomial |
| -> Integer | |
| -> Maybe Integer |
Inversion of @n over F₂m using extended Euclidean algorithm.
If @n doesn't have an inverse, Nothing is returned.