Copyright | (c) Marcel Fourné 20[09..] |
---|---|
License | BSD3 |
Maintainer | Marcel Fourné (haskell@marcelfourne.de) |
Stability | alpha |
Portability | Good |
Safe Haskell | None |
Language | Haskell98 |
Functions for F_{2^{E}} Re Timing-Attacks: We depend on (==) being resistant for Integer. This backend is faulty and slow.
- data F2 = F2 !Int !(Vector Word)
- eq :: F2 -> F2 -> Bool
- add :: F2 -> F2 -> F2
- addr :: F2 -> F2 -> F2 -> F2
- shift :: F2 -> Int -> F2
- mul :: F2 -> F2 -> F2
- mulr :: F2 -> F2 -> F2 -> F2
- testBit :: F2 -> Int -> Bool
- redc :: F2 -> F2 -> F2
- square :: F2 -> F2
- pow :: (Bits a, Integral a) => F2 -> F2 -> a -> F2
- inv :: F2 -> F2 -> F2
- fromInteger :: Int -> Integer -> F2
- toInteger :: F2 -> Integer
Documentation
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.
redc :: F2 -> F2 -> F2 Source #
polynomial reduction, simple scan TODO: idempotent? not right now -> ERROR!
pow :: (Bits a, Integral a) => F2 -> F2 -> a -> F2 Source #
the power function on F2 for positive exponents, reducing early