libsecp256k1-0.0.1: Bindings for secp256k1
LicenseUNLICENSE
MaintainerKeagan McClelland <keagan.mcclelland@gmail.com>
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe-Inferred
LanguageHaskell2010

Crypto.Secp256k1

Description

Crytpographic functions from Bitcoin’s secp256k1 library.

Synopsis

Messages

data Msg Source #

Instances

Instances details
Arbitrary Msg Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

arbitrary :: Gen Msg

shrink :: Msg -> [Msg]

IsString Msg Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

fromString :: String -> Msg #

Generic Msg Source # 
Instance details

Defined in Crypto.Secp256k1

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

Show Msg Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

showsPrec :: Int -> Msg -> ShowS #

show :: Msg -> String #

showList :: [Msg] -> ShowS #

Serialize Msg Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

put :: Putter Msg

get :: Get Msg

NFData Msg Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

rnf :: Msg -> () #

Eq Msg Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

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

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

Hashable Msg Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

hashWithSalt :: Int -> Msg -> Int

hash :: Msg -> Int

type Rep Msg Source # 
Instance details

Defined in Crypto.Secp256k1

type Rep Msg = D1 ('MetaData "Msg" "Crypto.Secp256k1" "libsecp256k1-0.0.1-inplace" 'True) (C1 ('MetaCons "Msg" 'PrefixI 'True) (S1 ('MetaSel ('Just "getMsg") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))

msg :: ByteString -> Maybe Msg Source #

Import 32-byte ByteString as Msg.

Secret Keys

data SecKey Source #

Instances

Instances details
Arbitrary SecKey Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

arbitrary :: Gen SecKey

shrink :: SecKey -> [SecKey]

IsString SecKey Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

fromString :: String -> SecKey #

Generic SecKey Source # 
Instance details

Defined in Crypto.Secp256k1

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

Show SecKey Source # 
Instance details

Defined in Crypto.Secp256k1

Serialize SecKey Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

put :: Putter SecKey

get :: Get SecKey

NFData SecKey Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

rnf :: SecKey -> () #

Eq SecKey Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

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

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

Hashable SecKey Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

hashWithSalt :: Int -> SecKey -> Int

hash :: SecKey -> Int

type Rep SecKey Source # 
Instance details

Defined in Crypto.Secp256k1

type Rep SecKey = D1 ('MetaData "SecKey" "Crypto.Secp256k1" "libsecp256k1-0.0.1-inplace" 'True) (C1 ('MetaCons "SecKey" 'PrefixI 'True) (S1 ('MetaSel ('Just "getSecKey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))

Public Keys

data PubKey Source #

Instances

Instances details
Arbitrary PubKey Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

arbitrary :: Gen PubKey

shrink :: PubKey -> [PubKey]

IsString PubKey Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

fromString :: String -> PubKey #

Generic PubKey Source # 
Instance details

Defined in Crypto.Secp256k1

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

Show PubKey Source # 
Instance details

Defined in Crypto.Secp256k1

Serialize PubKey Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

put :: Putter PubKey

get :: Get PubKey

NFData PubKey Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

rnf :: PubKey -> () #

Eq PubKey Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

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

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

Hashable PubKey Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

hashWithSalt :: Int -> PubKey -> Int

hash :: PubKey -> Int

type Rep PubKey Source # 
Instance details

Defined in Crypto.Secp256k1

type Rep PubKey = D1 ('MetaData "PubKey" "Crypto.Secp256k1" "libsecp256k1-0.0.1-inplace" 'True) (C1 ('MetaCons "PubKey" 'PrefixI 'True) (S1 ('MetaSel ('Just "getPubKey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))

importPubKey :: ByteString -> Maybe PubKey Source #

Import DER-encoded public key.

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

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

Signatures

data Sig Source #

Instances

Instances details
IsString Sig Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

fromString :: String -> Sig #

Generic Sig Source # 
Instance details

Defined in Crypto.Secp256k1

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

Show Sig Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

showsPrec :: Int -> Sig -> ShowS #

show :: Sig -> String #

showList :: [Sig] -> ShowS #

Serialize Sig Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

put :: Putter Sig

get :: Get Sig

NFData Sig Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

rnf :: Sig -> () #

Eq Sig Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

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

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

Hashable Sig Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

hashWithSalt :: Int -> Sig -> Int

hash :: Sig -> Int

type Rep Sig Source # 
Instance details

Defined in Crypto.Secp256k1

type Rep Sig = D1 ('MetaData "Sig" "Crypto.Secp256k1" "libsecp256k1-0.0.1-inplace" 'True) (C1 ('MetaCons "Sig" 'PrefixI 'True) (S1 ('MetaSel ('Just "getSig") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))

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

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

normalizeSig :: Sig -> Maybe Sig Source #

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

DER

importSig :: ByteString -> Maybe Sig Source #

Import DER-encoded signature.

exportSig :: Sig -> ByteString Source #

Encode signature as strict DER.

Compact

data CompactSig Source #

Instances

Instances details
Generic CompactSig Source # 
Instance details

Defined in Crypto.Secp256k1

Associated Types

type Rep CompactSig :: Type -> Type #

Serialize CompactSig Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

put :: Putter CompactSig

get :: Get CompactSig

NFData CompactSig Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

rnf :: CompactSig -> () #

Eq CompactSig Source # 
Instance details

Defined in Crypto.Secp256k1

type Rep CompactSig Source # 
Instance details

Defined in Crypto.Secp256k1

type Rep CompactSig = D1 ('MetaData "CompactSig" "Crypto.Secp256k1" "libsecp256k1-0.0.1-inplace" 'True) (C1 ('MetaCons "CompactSig" 'PrefixI 'True) (S1 ('MetaSel ('Just "getCompactSig") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))

Addition & Multiplication

data Tweak Source #

Instances

Instances details
IsString Tweak Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

fromString :: String -> Tweak #

Generic Tweak Source # 
Instance details

Defined in Crypto.Secp256k1

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

Show Tweak Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

showsPrec :: Int -> Tweak -> ShowS #

show :: Tweak -> String #

showList :: [Tweak] -> ShowS #

Serialize Tweak Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

put :: Putter Tweak

get :: Get Tweak

NFData Tweak Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

rnf :: Tweak -> () #

Eq Tweak Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

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

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

Hashable Tweak Source # 
Instance details

Defined in Crypto.Secp256k1

Methods

hashWithSalt :: Int -> Tweak -> Int

hash :: Tweak -> Int

type Rep Tweak Source # 
Instance details

Defined in Crypto.Secp256k1

type Rep Tweak = D1 ('MetaData "Tweak" "Crypto.Secp256k1" "libsecp256k1-0.0.1-inplace" 'True) (C1 ('MetaCons "Tweak" 'PrefixI 'True) (S1 ('MetaSel ('Just "getTweak") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))

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

Add tweak to secret key.

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

Multiply secret key by tweak.

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

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

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

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

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

Add multiple public keys together.