mirror of
https://github.com/ilyakooo0/secp256k1-haskell.git
synced 2024-09-11 12:25:38 +03:00
Add NFData instances for everything
This commit is contained in:
parent
cd3de8e9d4
commit
9a69417fde
@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## 0.1.7
|
||||
### Added
|
||||
- Add `NFData` instances for all types.
|
||||
|
||||
## 0.1.6
|
||||
### Added
|
||||
- Use `pkgconfig` for C library dependency.
|
||||
|
@ -1,10 +1,10 @@
|
||||
name: secp256k1-haskell
|
||||
version: 0.1.6
|
||||
version: 0.1.7
|
||||
synopsis: Bindings for secp256k1 library from Bitcoin Core
|
||||
description: Sign and verify signatures using the very fast C secp256k1 library from Pieter Wuille. Has Haskell types and abstractions for keys and signatures.
|
||||
category: Crypto
|
||||
author: Jean-Pierre Rupp
|
||||
maintainer: xenog@protonmail.com
|
||||
maintainer: jprupp@protonmail.ch
|
||||
copyright: (c) 2017 Jean-Pierre Rupp
|
||||
license: PublicDomain
|
||||
license-file: UNLICENSE
|
||||
@ -19,6 +19,7 @@ dependencies:
|
||||
- bytestring
|
||||
- cereal
|
||||
- entropy
|
||||
- deepseq
|
||||
- hashable
|
||||
- QuickCheck
|
||||
- string-conversions
|
||||
|
@ -74,11 +74,10 @@ import Data.Maybe (fromJust, fromMaybe, isJust)
|
||||
import Data.Serialize (decode, encode)
|
||||
import Data.String (IsString (..))
|
||||
import Data.String.Conversions (ConvertibleStrings, cs)
|
||||
import Foreign (ForeignPtr (..), alloca,
|
||||
allocaArray, allocaBytes,
|
||||
mallocForeignPtr, nullFunPtr,
|
||||
nullPtr, peek, poke, pokeArray,
|
||||
withForeignPtr)
|
||||
import Foreign (ForeignPtr, alloca, allocaArray,
|
||||
allocaBytes, mallocForeignPtr,
|
||||
nullFunPtr, nullPtr, peek, poke,
|
||||
pokeArray, withForeignPtr)
|
||||
import System.IO.Unsafe (unsafePerformIO)
|
||||
import Test.QuickCheck (Arbitrary (..),
|
||||
arbitraryBoundedRandom, suchThat)
|
||||
|
@ -1,4 +1,6 @@
|
||||
{-# LANGUAGE CPP #-}
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE RecordWildCards #-}
|
||||
{-|
|
||||
Module : Crypto.Secp256k1.Internal
|
||||
@ -12,6 +14,7 @@ exposed for hacking and experimentation.
|
||||
-}
|
||||
module Crypto.Secp256k1.Internal where
|
||||
|
||||
import Control.DeepSeq
|
||||
import Control.Monad
|
||||
import Data.ByteString (ByteString)
|
||||
import qualified Data.ByteString as BS
|
||||
@ -21,29 +24,30 @@ import qualified Data.Serialize.Get as Get
|
||||
import qualified Data.Serialize.Put as Put
|
||||
import Foreign
|
||||
import Foreign.C
|
||||
import GHC.Generics (Generic)
|
||||
import System.Entropy
|
||||
import System.IO.Unsafe
|
||||
|
||||
data Ctx = Ctx
|
||||
|
||||
newtype PubKey64 = PubKey64 { getPubKey64 :: ShortByteString }
|
||||
deriving (Read, Show, Eq, Ord)
|
||||
deriving (Read, Show, Eq, Ord, Generic, NFData)
|
||||
|
||||
newtype Msg32 = Msg32 { getMsg32 :: ShortByteString }
|
||||
deriving (Read, Show, Eq, Ord)
|
||||
deriving (Read, Show, Eq, Ord, Generic, NFData)
|
||||
|
||||
newtype Sig64 = Sig64 { getSig64 :: ShortByteString }
|
||||
deriving (Read, Show, Eq, Ord)
|
||||
deriving (Read, Show, Eq, Ord, Generic, NFData)
|
||||
|
||||
data CompactSig =
|
||||
CompactSig
|
||||
{ getCompactSigR :: !ShortByteString
|
||||
, getCompactSigS :: !ShortByteString
|
||||
}
|
||||
deriving (Show, Eq, Ord)
|
||||
deriving (Show, Eq, Ord, Generic, NFData)
|
||||
|
||||
newtype RecSig65 = RecSig65 { getRecSig65 :: ShortByteString }
|
||||
deriving (Read, Show, Eq, Ord)
|
||||
deriving (Read, Show, Eq, Ord, Generic, NFData)
|
||||
|
||||
data CompactRecSig =
|
||||
CompactRecSig
|
||||
@ -51,31 +55,31 @@ data CompactRecSig =
|
||||
, getCompactRecSigS :: !ShortByteString
|
||||
, getCompactRecSigV :: !Word8
|
||||
}
|
||||
deriving (Show, Eq, Ord)
|
||||
deriving (Show, Eq, Ord, Generic, NFData)
|
||||
|
||||
newtype Seed32 = Seed32 { getSeed32 :: ShortByteString }
|
||||
deriving (Read, Show, Eq, Ord)
|
||||
deriving (Read, Show, Eq, Ord, Generic, NFData)
|
||||
|
||||
newtype SecKey32 = SecKey32 { getSecKey32 :: ShortByteString }
|
||||
deriving (Read, Show, Eq, Ord)
|
||||
deriving (Read, Show, Eq, Ord, Generic, NFData)
|
||||
|
||||
newtype Tweak32 = Tweak32 { getTweak32 :: ShortByteString }
|
||||
deriving (Read, Show, Eq, Ord)
|
||||
deriving (Read, Show, Eq, Ord, Generic, NFData)
|
||||
|
||||
newtype Nonce32 = Nonce32 { getNonce32 :: ShortByteString }
|
||||
deriving (Read, Show, Eq, Ord)
|
||||
deriving (Read, Show, Eq, Ord, Generic, NFData)
|
||||
|
||||
newtype Algo16 = Algo16 { getAlgo16 :: ShortByteString }
|
||||
deriving (Read, Show, Eq, Ord)
|
||||
deriving (Read, Show, Eq, Ord, Generic, NFData)
|
||||
|
||||
newtype CtxFlags = CtxFlags { getCtxFlags :: CUInt }
|
||||
deriving (Read, Show, Eq, Ord)
|
||||
deriving (Read, Show, Eq, Ord, Generic, NFData)
|
||||
|
||||
newtype SerFlags = SerFlags { getSerFlags :: CUInt }
|
||||
deriving (Read, Show, Eq, Ord)
|
||||
deriving (Read, Show, Eq, Ord, Generic, NFData)
|
||||
|
||||
newtype Ret = Ret { getRet :: CInt }
|
||||
deriving (Read, Show, Eq, Ord)
|
||||
deriving (Read, Show, Eq, Ord, Generic, NFData)
|
||||
|
||||
-- | Nonce32-generating function
|
||||
type NonceFunction a
|
||||
|
@ -1,4 +1,4 @@
|
||||
resolver: lts-14.19
|
||||
resolver: lts-14.20
|
||||
nix:
|
||||
packages:
|
||||
- secp256k1
|
||||
|
@ -6,7 +6,7 @@
|
||||
packages: []
|
||||
snapshots:
|
||||
- completed:
|
||||
size: 524155
|
||||
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/14/19.yaml
|
||||
sha256: 9f79f6494473c9b46911364b94c4b5ef19ca8d35ebf62e46697cf651f198ee19
|
||||
original: lts-14.19
|
||||
size: 524154
|
||||
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/14/20.yaml
|
||||
sha256: 2f5099f69ddb6abfe64400fe1e6a604e8e628f55e6837211cd70a81eb0a8fa4d
|
||||
original: lts-14.20
|
||||
|
Loading…
Reference in New Issue
Block a user