-----------------------------------------------------------------------------
-- |
-- Module      :  Codec.Crypto.ECC.ECDH
-- Copyright   :  (c) Marcel Fourné 20[09..13]
-- License     :  BSD3
-- Maintainer  :  Marcel Fourné (mail@marcelfourne.de)
-- Stability   :  experimental
-- Portability :  Good
--
-- basic ECDH functions using hecc
--
-----------------------------------------------------------------------------

{-# OPTIONS_GHC -O2 -fllvm -optlo-O3 -feager-blackholing #-}

module Codec.Crypto.ECC.ECDH
    where

import Codec.Crypto.ECC.Base
-- import Codec.Crypto.ECC.StandardCurves

-- private key dA of this side and public key qB of the communication partner, returning the simple x coordinate as result
-- to be executed on both sides with fitting parameters...
-- d = pickOne [1..N-1]
-- q = pmul G d
-- | basic ecdh for testing
basicecdh :: Integer -> ECPF Integer -> Integer
basicecdh dA qB = getx $ pmul qB dA