cryptonite-0.23: Cryptography Primitives sink

Crypto.PubKey.DH

Description

Synopsis

# Documentation

data Params #

Represent Diffie Hellman parameters namely P (prime), and G (generator).

Constructors

 Params Fieldsparams_p :: Integer params_g :: Integer params_bits :: Int

Instances

 # Methods(==) :: Params -> Params -> Bool #(/=) :: Params -> Params -> Bool # # Methodsgfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Params -> c Params #gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Params #dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Params) #dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Params) #gmapT :: (forall b. Data b => b -> b) -> Params -> Params #gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Params -> r #gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Params -> r #gmapQ :: (forall d. Data d => d -> u) -> Params -> [u] #gmapQi :: Int -> (forall d. Data d => d -> u) -> Params -> u #gmapM :: Monad m => (forall d. Data d => d -> m d) -> Params -> m Params #gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Params -> m Params #gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Params -> m Params # # Methods # MethodsshowsPrec :: Int -> Params -> ShowS #showList :: [Params] -> ShowS #

newtype PublicNumber #

Represent Diffie Hellman public number Y.

Constructors

 PublicNumber Integer

Instances

 # Methods # Methods # Methods # Methods # Methods # Methods # MethodsshowList :: [PublicNumber] -> ShowS #

newtype PrivateNumber #

Represent Diffie Hellman private number X.

Constructors

 PrivateNumber Integer

Instances

 # Methods # Methods # Methods # Methods # Methods # Methods # MethodsshowList :: [PrivateNumber] -> ShowS #

newtype SharedKey #

Represent Diffie Hellman shared secret.

Constructors

 SharedKey ScrubbedBytes

Instances

 # Methods # MethodsshowList :: [SharedKey] -> ShowS # # MethodswithByteArray :: SharedKey -> (Ptr p -> IO a) -> IO a #

Arguments

 :: MonadRandom m => Int number of bits -> Integer generator -> m Params

generate params from a specific generator (2 or 5 are common values) we generate a safe prime (a prime number of the form 2p+1 where p is also prime)

generate a private number with no specific property this number is usually called X in DH text.

calculate the public number from the parameters and the private key this number is usually called Y in DH text.

calculate the public number from the parameters and the private key this number is usually called Y in DH text.

DEPRECATED use calculatePublic

generate a shared key using our private number and the other party public number
{"ft_lang_label":"__label__en","ft_lang_prob":0.63572425,"math_prob":0.59271383,"size":2907,"snap":"2022-27-2022-33","text_gpt3_token_len":789,"char_repetition_ratio":0.21184981,"word_repetition_ratio":0.3056058,"special_character_ratio":0.32954937,"punctuation_ratio":0.15254237,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97888476,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-06-30T23:31:32Z\",\"WARC-Record-ID\":\"<urn:uuid:3d33dcd1-e962-4a1d-9627-41981c0cb95f>\",\"Content-Length\":\"78677\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:2426d3a2-738a-41b7-9ae2-fdf42e3827be>\",\"WARC-Concurrent-To\":\"<urn:uuid:f6862133-64ed-4e03-bd2e-850e8014d88e>\",\"WARC-IP-Address\":\"52.217.69.155\",\"WARC-Target-URI\":\"http://support.hfm.io/1.6/api/cryptonite-0.23/Crypto-PubKey-DH.html\",\"WARC-Payload-Digest\":\"sha1:TC4FGO7QMGMNGOS2OV6L4IEYUQXR7WMN\",\"WARC-Block-Digest\":\"sha1:CXK42M4LXCBRO32KGZ7FBZGRBB33DUGE\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-27/CC-MAIN-2022-27_segments_1656103915196.47_warc_CC-MAIN-20220630213820-20220701003820-00193.warc.gz\"}"}