fix spelling of "exponent"

This commit is contained in:
Chris Martin 2018-04-05 21:40:50 -04:00 committed by John Galt
parent 8b508302eb
commit d2da00445d
3 changed files with 8 additions and 8 deletions

View File

@ -28,7 +28,7 @@ data CoprimesAssertionError = CoprimesAssertionError
instance Exception 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 -- algorithms design to avoid side channels and timing measurement
-- --
-- Modulo need to be odd otherwise the normal fast modular exponentiation -- 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 -- (which is now integer-gmp2), so is has the same security as old
-- ghc version. -- ghc version.
expSafe :: Integer -- ^ base expSafe :: Integer -- ^ base
-> Integer -- ^ exponant -> Integer -- ^ exponent
-> Integer -- ^ modulo -> Integer -- ^ modulo
-> Integer -- ^ result -> Integer -- ^ result
expSafe b e m expSafe b e m
@ -52,14 +52,14 @@ expSafe b e m
| otherwise = gmpPowModInteger b e m `onGmpUnsupported` | otherwise = gmpPowModInteger b e m `onGmpUnsupported`
exponentiation b e m 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 -- the fastest algorithm without any consideration for
-- hiding parameters. -- hiding parameters.
-- --
-- Use this function when all the parameters are public, -- Use this function when all the parameters are public,
-- otherwise 'expSafe' should be prefered. -- otherwise 'expSafe' should be prefered.
expFast :: Integer -- ^ base expFast :: Integer -- ^ base
-> Integer -- ^ exponant -> Integer -- ^ exponent
-> Integer -- ^ modulo -> Integer -- ^ modulo
-> Integer -- ^ result -> Integer -- ^ result
expFast b e m = gmpPowModInteger b e m `onGmpUnsupported` exponentiation b e m expFast b e m = gmpPowModInteger b e m `onGmpUnsupported` exponentiation b e m

View File

@ -55,7 +55,7 @@ toPositive int
-- --
generateWith :: (Integer, Integer) -- ^ chosen distinct primes p and q generateWith :: (Integer, Integer) -- ^ chosen distinct primes p and q
-> Int -- ^ size in bytes -> Int -- ^ size in bytes
-> Integer -- ^ RSA public exponant 'e' -> Integer -- ^ RSA public exponent 'e'
-> Maybe (PublicKey, PrivateKey) -> Maybe (PublicKey, PrivateKey)
generateWith (p,q) size e = generateWith (p,q) size e =
case inverse e phi of 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 a pair of (private, public) key of size in bytes.
generate :: MonadRandom m generate :: MonadRandom m
=> Int -- ^ size in bytes => Int -- ^ size in bytes
-> Integer -- ^ RSA public exponant 'e' -> Integer -- ^ RSA public exponent 'e'
-> m (PublicKey, PrivateKey) -> m (PublicKey, PrivateKey)
generate size e = loop generate size e = loop
where where

View File

@ -41,7 +41,7 @@ data Error =
data PublicKey = PublicKey data PublicKey = PublicKey
{ public_size :: Int -- ^ size of key in bytes { public_size :: Int -- ^ size of key in bytes
, public_n :: Integer -- ^ public p*q , public_n :: Integer -- ^ public p*q
, public_e :: Integer -- ^ public exponant e , public_e :: Integer -- ^ public exponent e
} deriving (Show,Read,Eq,Data,Typeable) } deriving (Show,Read,Eq,Data,Typeable)
instance NFData PublicKey where instance NFData PublicKey where
@ -59,7 +59,7 @@ instance NFData PublicKey where
-- --
data PrivateKey = PrivateKey data PrivateKey = PrivateKey
{ private_pub :: PublicKey -- ^ public part of a private key (size, n and e) { 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_p :: Integer -- ^ p prime number
, private_q :: Integer -- ^ q prime number , private_q :: Integer -- ^ q prime number
, private_dP :: Integer -- ^ d mod (p-1) , private_dP :: Integer -- ^ d mod (p-1)