secp256k1-haskell-1.2.0: Bindings for secp256k1
LicenseUNLICENSE
MaintainerJean-Pierre Rupp <jprupp@protonmail.ch>
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe-Inferred
LanguageHaskell2010

Crypto.Secp256k1.Internal.Base

Description

Crytpographic functions from Bitcoin’s secp256k1 library.

The API for this module may change at any time. This is an internal module only exposed for hacking and experimentation.

Synopsis

Documentation

newtype PubKey Source #

Constructors

PubKey 

Fields

Instances

Instances details
IsString PubKey Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

fromString :: String -> PubKey #

Generic PubKey Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Associated Types

type Rep PubKey :: Type -> Type #

Methods

from :: PubKey -> Rep PubKey x #

to :: Rep PubKey x -> PubKey #

Read PubKey Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Show PubKey Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

NFData PubKey Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

rnf :: PubKey -> () #

Eq PubKey Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

(==) :: PubKey -> PubKey -> Bool #

(/=) :: PubKey -> PubKey -> Bool #

Hashable PubKey Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

hashWithSalt :: Int -> PubKey -> Int #

hash :: PubKey -> Int #

type Rep PubKey Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

type Rep PubKey = D1 ('MetaData "PubKey" "Crypto.Secp256k1.Internal.Base" "secp256k1-haskell-1.2.0-5hhTrFzbY7H83oJyj7uSnR" 'True) (C1 ('MetaCons "PubKey" 'PrefixI 'True) (S1 ('MetaSel ('Just "get") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))

newtype Msg Source #

Constructors

Msg 

Fields

Instances

Instances details
Arbitrary Msg Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

arbitrary :: Gen Msg #

shrink :: Msg -> [Msg] #

IsString Msg Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

fromString :: String -> Msg #

Generic Msg Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Associated Types

type Rep Msg :: Type -> Type #

Methods

from :: Msg -> Rep Msg x #

to :: Rep Msg x -> Msg #

Read Msg Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Show Msg Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

showsPrec :: Int -> Msg -> ShowS #

show :: Msg -> String #

showList :: [Msg] -> ShowS #

NFData Msg Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

rnf :: Msg -> () #

Eq Msg Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

(==) :: Msg -> Msg -> Bool #

(/=) :: Msg -> Msg -> Bool #

Hashable Msg Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

hashWithSalt :: Int -> Msg -> Int #

hash :: Msg -> Int #

type Rep Msg Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

type Rep Msg = D1 ('MetaData "Msg" "Crypto.Secp256k1.Internal.Base" "secp256k1-haskell-1.2.0-5hhTrFzbY7H83oJyj7uSnR" 'True) (C1 ('MetaCons "Msg" 'PrefixI 'True) (S1 ('MetaSel ('Just "get") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))

newtype Sig Source #

Constructors

Sig 

Fields

Instances

Instances details
IsString Sig Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

fromString :: String -> Sig #

Generic Sig Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Associated Types

type Rep Sig :: Type -> Type #

Methods

from :: Sig -> Rep Sig x #

to :: Rep Sig x -> Sig #

Read Sig Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Show Sig Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

showsPrec :: Int -> Sig -> ShowS #

show :: Sig -> String #

showList :: [Sig] -> ShowS #

NFData Sig Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

rnf :: Sig -> () #

Eq Sig Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

(==) :: Sig -> Sig -> Bool #

(/=) :: Sig -> Sig -> Bool #

Hashable Sig Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

hashWithSalt :: Int -> Sig -> Int #

hash :: Sig -> Int #

type Rep Sig Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

type Rep Sig = D1 ('MetaData "Sig" "Crypto.Secp256k1.Internal.Base" "secp256k1-haskell-1.2.0-5hhTrFzbY7H83oJyj7uSnR" 'True) (C1 ('MetaCons "Sig" 'PrefixI 'True) (S1 ('MetaSel ('Just "get") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))

newtype SecKey Source #

Constructors

SecKey 

Fields

Instances

Instances details
Arbitrary SecKey Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

IsString SecKey Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

fromString :: String -> SecKey #

Generic SecKey Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Associated Types

type Rep SecKey :: Type -> Type #

Methods

from :: SecKey -> Rep SecKey x #

to :: Rep SecKey x -> SecKey #

Read SecKey Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Show SecKey Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

NFData SecKey Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

rnf :: SecKey -> () #

Eq SecKey Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

(==) :: SecKey -> SecKey -> Bool #

(/=) :: SecKey -> SecKey -> Bool #

Hashable SecKey Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

hashWithSalt :: Int -> SecKey -> Int #

hash :: SecKey -> Int #

type Rep SecKey Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

type Rep SecKey = D1 ('MetaData "SecKey" "Crypto.Secp256k1.Internal.Base" "secp256k1-haskell-1.2.0-5hhTrFzbY7H83oJyj7uSnR" 'True) (C1 ('MetaCons "SecKey" 'PrefixI 'True) (S1 ('MetaSel ('Just "get") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))

newtype Tweak Source #

Constructors

Tweak 

Fields

Instances

Instances details
IsString Tweak Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

fromString :: String -> Tweak #

Generic Tweak Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Associated Types

type Rep Tweak :: Type -> Type #

Methods

from :: Tweak -> Rep Tweak x #

to :: Rep Tweak x -> Tweak #

Read Tweak Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Show Tweak Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

showsPrec :: Int -> Tweak -> ShowS #

show :: Tweak -> String #

showList :: [Tweak] -> ShowS #

NFData Tweak Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

rnf :: Tweak -> () #

Eq Tweak Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

(==) :: Tweak -> Tweak -> Bool #

(/=) :: Tweak -> Tweak -> Bool #

Hashable Tweak Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

hashWithSalt :: Int -> Tweak -> Int #

hash :: Tweak -> Int #

type Rep Tweak Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

type Rep Tweak = D1 ('MetaData "Tweak" "Crypto.Secp256k1.Internal.Base" "secp256k1-haskell-1.2.0-5hhTrFzbY7H83oJyj7uSnR" 'True) (C1 ('MetaCons "Tweak" 'PrefixI 'True) (S1 ('MetaSel ('Just "get") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))

newtype CompactSig Source #

Constructors

CompactSig 

Fields

Instances

Instances details
Generic CompactSig Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Associated Types

type Rep CompactSig :: Type -> Type #

NFData CompactSig Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Methods

rnf :: CompactSig -> () #

Eq CompactSig Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

Hashable CompactSig Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

type Rep CompactSig Source # 
Instance details

Defined in Crypto.Secp256k1.Internal.Base

type Rep CompactSig = D1 ('MetaData "CompactSig" "Crypto.Secp256k1.Internal.Base" "secp256k1-haskell-1.2.0-5hhTrFzbY7H83oJyj7uSnR" 'True) (C1 ('MetaCons "CompactSig" 'PrefixI 'True) (S1 ('MetaSel ('Just "get") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))

sig :: ByteString -> Maybe Sig Source #

Import 64-byte ByteString as Sig.

msg :: ByteString -> Maybe Msg Source #

Import 32-byte ByteString as Msg.

normalizeSig :: Ctx -> Sig -> Maybe Sig Source #

Convert signature to a normalized lower-S form. Nothing indicates that it was already normal.

importPubKey :: Ctx -> ByteString -> Maybe PubKey Source #

Import DER-encoded public key.

exportPubKey :: Ctx -> Bool -> PubKey -> ByteString Source #

Encode public key as DER. First argument True for compressed output.

importSig :: Ctx -> ByteString -> Maybe Sig Source #

Import DER-encoded signature.

exportSig :: Ctx -> Sig -> ByteString Source #

Encode signature as strict DER.

verifySig :: Ctx -> PubKey -> Sig -> Msg -> Bool Source #

Verify message signature. True means that the signature is correct.

tweakAddSecKey :: Ctx -> SecKey -> Tweak -> Maybe SecKey Source #

Add tweak to secret key.

tweakMulSecKey :: Ctx -> SecKey -> Tweak -> Maybe SecKey Source #

Multiply secret key by tweak.

tweakAddPubKey :: Ctx -> PubKey -> Tweak -> Maybe PubKey Source #

Add tweak to public key. Tweak is multiplied first by G to obtain a point.

tweakMulPubKey :: Ctx -> PubKey -> Tweak -> Maybe PubKey Source #

Multiply public key by tweak. Tweak is multiplied first by G to obtain a point.

combinePubKeys :: Ctx -> [PubKey] -> Maybe PubKey Source #

Add multiple public keys together.