fix spelling of "exponent"
This commit is contained in:
parent
8b508302eb
commit
d2da00445d
@ -28,7 +28,7 @@ data CoprimesAssertionError = CoprimesAssertionError
|
||||
|
||||
instance Exception CoprimesAssertionError
|
||||
|
||||
-- | Compute the modular exponentiation of base^exponant using
|
||||
-- | Compute the modular exponentiation of base^exponent using
|
||||
-- algorithms design to avoid side channels and timing measurement
|
||||
--
|
||||
-- Modulo need to be odd otherwise the normal fast modular exponentiation
|
||||
@ -42,7 +42,7 @@ instance Exception CoprimesAssertionError
|
||||
-- (which is now integer-gmp2), so is has the same security as old
|
||||
-- ghc version.
|
||||
expSafe :: Integer -- ^ base
|
||||
-> Integer -- ^ exponant
|
||||
-> Integer -- ^ exponent
|
||||
-> Integer -- ^ modulo
|
||||
-> Integer -- ^ result
|
||||
expSafe b e m
|
||||
@ -52,14 +52,14 @@ expSafe b e m
|
||||
| otherwise = gmpPowModInteger b e m `onGmpUnsupported`
|
||||
exponentiation b e m
|
||||
|
||||
-- | Compute the modular exponentiation of base^exponant using
|
||||
-- | Compute the modular exponentiation of base^exponent using
|
||||
-- the fastest algorithm without any consideration for
|
||||
-- hiding parameters.
|
||||
--
|
||||
-- Use this function when all the parameters are public,
|
||||
-- otherwise 'expSafe' should be prefered.
|
||||
expFast :: Integer -- ^ base
|
||||
-> Integer -- ^ exponant
|
||||
-> Integer -- ^ exponent
|
||||
-> Integer -- ^ modulo
|
||||
-> Integer -- ^ result
|
||||
expFast b e m = gmpPowModInteger b e m `onGmpUnsupported` exponentiation b e m
|
||||
|
||||
@ -55,7 +55,7 @@ toPositive int
|
||||
--
|
||||
generateWith :: (Integer, Integer) -- ^ chosen distinct primes p and q
|
||||
-> Int -- ^ size in bytes
|
||||
-> Integer -- ^ RSA public exponant 'e'
|
||||
-> Integer -- ^ RSA public exponent 'e'
|
||||
-> Maybe (PublicKey, PrivateKey)
|
||||
generateWith (p,q) size e =
|
||||
case inverse e phi of
|
||||
@ -81,7 +81,7 @@ generateWith (p,q) size e =
|
||||
-- | generate a pair of (private, public) key of size in bytes.
|
||||
generate :: MonadRandom m
|
||||
=> Int -- ^ size in bytes
|
||||
-> Integer -- ^ RSA public exponant 'e'
|
||||
-> Integer -- ^ RSA public exponent 'e'
|
||||
-> m (PublicKey, PrivateKey)
|
||||
generate size e = loop
|
||||
where
|
||||
|
||||
@ -41,7 +41,7 @@ data Error =
|
||||
data PublicKey = PublicKey
|
||||
{ public_size :: Int -- ^ size of key in bytes
|
||||
, public_n :: Integer -- ^ public p*q
|
||||
, public_e :: Integer -- ^ public exponant e
|
||||
, public_e :: Integer -- ^ public exponent e
|
||||
} deriving (Show,Read,Eq,Data,Typeable)
|
||||
|
||||
instance NFData PublicKey where
|
||||
@ -59,7 +59,7 @@ instance NFData PublicKey where
|
||||
--
|
||||
data PrivateKey = PrivateKey
|
||||
{ private_pub :: PublicKey -- ^ public part of a private key (size, n and e)
|
||||
, private_d :: Integer -- ^ private exponant d
|
||||
, private_d :: Integer -- ^ private exponent d
|
||||
, private_p :: Integer -- ^ p prime number
|
||||
, private_q :: Integer -- ^ q prime number
|
||||
, private_dP :: Integer -- ^ d mod (p-1)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user