bitcoin-hs-0.0.1: Partial implementation of the Bitcoin protocol (as of 2013)

Safe HaskellNone
LanguageHaskell98

Bitcoin.Crypto.EC.DiffieHellman

Description

Diffie-Hellman key exchange

Synopsis

Documentation

diffieHellmanPrimitive :: PrivKey -> PubKey -> Maybe SharedSecret Source #

Given your private key and somebody else's public key, this compute a (256 bit) shared secret.

This is actually very simple: since pubkey = G * privkey, the shared secret will be simply G * privkey1 * privkey2.

This can fail if for example an invalid pubkey is given, and in some other special circumstances.