saltine-0.1.1.1: Cryptography that's easy to digest (NaCl/libsodium bindings).
Copyright(c) Joseph Abrahamson 2013
LicenseMIT
Maintainerme@jspha.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Crypto.Saltine.Core.ScalarMult

Description

Scalar multiplication: Crypto.Saltine.Core.ScalarMult

The mult function multiplies a group element by an integer of length multScalar. It returns the resulting group element of length mult. The multBase function multiplies a standard group element by an integer of length multScalar. It returns the resulting group element of length mult.

The correspondence between strings and group elements depends on the primitive implemented by mult. The correspondence is not necessarily injective in either direction, but it is compatible with scalar multiplication in the group. The correspondence does not necessarily include all group elements, but it does include all strings; i.e., every string represents at least one group element.

The correspondence between strings and integers also depends on the primitive implemented by mult. Every string represents at least one integer.

mult is designed to be strong as a component of various well-known "hashed Diffie–Hellman" applications. In particular, it is designed to make the "computational Diffie–Hellman" problem (CDH) difficult with respect to the standard base. mult is also designed to make CDH difficult with respect to other nontrivial bases. In particular, if a represented group element has small order, then it is annihilated by all represented scalars. This feature allows protocols to avoid validating membership in the subgroup generated by the standard base.

NaCl does not make any promises regarding the "decisional Diffie–Hellman" problem (DDH), the "static Diffie–Hellman" problem (SDH), etc. Users are responsible for hashing group elements.

mult is the function crypto_scalarmult_curve25519 specified in "Cryptography in NaCl", Sections 2, 3, and 4 (http://nacl.cr.yp.to/valid.html). This function is conjectured to be strong. For background see Bernstein, "Curve25519: new Diffie-Hellman speed records," Lecture Notes in Computer Science 3958 (2006), 207–228, http://cr.yp.to/papers.html#curve25519.

This is version 2010.08.30 of the scalarmult.html web page.

Synopsis

Documentation

data Scalar Source #

A scalar integer.

Instances

Instances details
Eq Scalar Source # 
Instance details

Defined in Crypto.Saltine.Core.ScalarMult

Methods

(==) :: Scalar -> Scalar -> Bool #

(/=) :: Scalar -> Scalar -> Bool #

Data Scalar Source # 
Instance details

Defined in Crypto.Saltine.Core.ScalarMult

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Scalar -> c Scalar #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Scalar #

toConstr :: Scalar -> Constr #

dataTypeOf :: Scalar -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Scalar) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Scalar) #

gmapT :: (forall b. Data b => b -> b) -> Scalar -> Scalar #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Scalar -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Scalar -> r #

gmapQ :: (forall d. Data d => d -> u) -> Scalar -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Scalar -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Scalar -> m Scalar #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Scalar -> m Scalar #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Scalar -> m Scalar #

Ord Scalar Source # 
Instance details

Defined in Crypto.Saltine.Core.ScalarMult

Generic Scalar Source # 
Instance details

Defined in Crypto.Saltine.Core.ScalarMult

Associated Types

type Rep Scalar :: Type -> Type #

Methods

from :: Scalar -> Rep Scalar x #

to :: Rep Scalar x -> Scalar #

Hashable Scalar Source # 
Instance details

Defined in Crypto.Saltine.Core.ScalarMult

Methods

hashWithSalt :: Int -> Scalar -> Int #

hash :: Scalar -> Int #

IsEncoding Scalar Source # 
Instance details

Defined in Crypto.Saltine.Core.ScalarMult

type Rep Scalar Source # 
Instance details

Defined in Crypto.Saltine.Core.ScalarMult

type Rep Scalar = D1 ('MetaData "Scalar" "Crypto.Saltine.Core.ScalarMult" "saltine-0.1.1.1-KbVmRAcWBV25w8Dlelbdig" 'True) (C1 ('MetaCons "Sc" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))

data GroupElement Source #

A group element.

Instances

Instances details
Eq GroupElement Source # 
Instance details

Defined in Crypto.Saltine.Core.ScalarMult

Data GroupElement Source # 
Instance details

Defined in Crypto.Saltine.Core.ScalarMult

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> GroupElement -> c GroupElement #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c GroupElement #

toConstr :: GroupElement -> Constr #

dataTypeOf :: GroupElement -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c GroupElement) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c GroupElement) #

gmapT :: (forall b. Data b => b -> b) -> GroupElement -> GroupElement #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> GroupElement -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> GroupElement -> r #

gmapQ :: (forall d. Data d => d -> u) -> GroupElement -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> GroupElement -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> GroupElement -> m GroupElement #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> GroupElement -> m GroupElement #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> GroupElement -> m GroupElement #

Ord GroupElement Source # 
Instance details

Defined in Crypto.Saltine.Core.ScalarMult

Generic GroupElement Source # 
Instance details

Defined in Crypto.Saltine.Core.ScalarMult

Associated Types

type Rep GroupElement :: Type -> Type #

Hashable GroupElement Source # 
Instance details

Defined in Crypto.Saltine.Core.ScalarMult

IsEncoding GroupElement Source # 
Instance details

Defined in Crypto.Saltine.Core.ScalarMult

type Rep GroupElement Source # 
Instance details

Defined in Crypto.Saltine.Core.ScalarMult

type Rep GroupElement = D1 ('MetaData "GroupElement" "Crypto.Saltine.Core.ScalarMult" "saltine-0.1.1.1-KbVmRAcWBV25w8Dlelbdig" 'True) (C1 ('MetaCons "GE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))