License | BSD-style |
---|---|
Maintainer | Vincent Hanquez <vincent@snarc.org> |
Stability | experimental |
Portability | unknown |
Safe Haskell | None |
Language | Haskell2010 |
P256 support
- data Scalar
- data Point
- pointAdd :: Point -> Point -> Point
- pointMul :: Scalar -> Point -> Point
- pointsMulVarTime :: Scalar -> Scalar -> Point -> Point
- pointIsValid :: Point -> Bool
- toPoint :: Scalar -> Point
- pointToIntegers :: Point -> (Integer, Integer)
- pointFromIntegers :: (Integer, Integer) -> Point
- pointToBinary :: ByteArray ba => Point -> ba
- pointFromBinary :: ByteArrayAccess ba => ba -> CryptoFailable Point
- scalarZero :: Scalar
- scalarIsZero :: Scalar -> Bool
- scalarAdd :: Scalar -> Scalar -> Scalar
- scalarSub :: Scalar -> Scalar -> Scalar
- scalarInv :: Scalar -> Scalar
- scalarCmp :: Scalar -> Scalar -> Ordering
- scalarFromBinary :: ByteArrayAccess ba => ba -> CryptoFailable Scalar
- scalarToBinary :: ByteArray ba => Scalar -> ba
- scalarFromInteger :: Integer -> CryptoFailable Scalar
- scalarToInteger :: Scalar -> Integer
Documentation
point arithmetic
pointsMulVarTime :: Scalar -> Scalar -> Point -> Point Source
multiply the point p with
n2 and add a lifted to curve value @n1
n1 * G + n2 * p
warning: variable time
pointIsValid :: Point -> Bool Source
Check if a Point
is valid
toPoint :: Scalar -> Point Source
Lift to curve a scalar
Using the curve generator as base point compute:
scalar * G
pointToIntegers :: Point -> (Integer, Integer) Source
pointFromIntegers :: (Integer, Integer) -> Point Source
pointToBinary :: ByteArray ba => Point -> ba Source
pointFromBinary :: ByteArrayAccess ba => ba -> CryptoFailable Point Source
scalar arithmetic
The scalar representing 0
scalarIsZero :: Scalar -> Bool Source
scalarFromBinary :: ByteArrayAccess ba => ba -> CryptoFailable Scalar Source
convert a scalar from binary
scalarToBinary :: ByteArray ba => Scalar -> ba Source
convert a scalar to binary
scalarToInteger :: Scalar -> Integer Source