secp256k1 0.1.5 → 0.1.6
raw patch · 2 files changed
+29/−5 lines, 2 files
Files
- secp256k1.cabal +1/−1
- src/Crypto/Secp256k1.hs +28/−4
secp256k1.cabal view
@@ -1,5 +1,5 @@ name: secp256k1-version: 0.1.5+version: 0.1.6 synopsis: secp256k1 bindings for Haskell description: Please see README.md homepage: http://github.com/haskoin/secp256k1#readme
src/Crypto/Secp256k1.hs view
@@ -14,13 +14,19 @@ module Crypto.Secp256k1 ( -- * Messages Msg, msg, getMsg- -- * Secret Keys-, SecKey, secKey, getSecKey, importSecKey, exportSecKey, pubKey- -- * Public Keys+ -- * Secret Key+, SecKey, importSecKey, exportSecKey, pubKey+ -- ** Raw Secret Key+, secKey, getSecKey+ -- * Public Key , PubKey, importPubKey, exportPubKey- -- * Signatures+ -- ** Raw Public Key+, unsafePubKey, getPubKey+ -- * Signature , Sig, importSig, exportSig , signMsg, verifySig+ -- ** Raw Signature+, unsafeSig, getSig -- * Addition & Multiplication , Tweak, tweak, getTweak , tweakAddSecKey, tweakMulSecKey@@ -168,6 +174,24 @@ if isSuccess ret then return $ Just $ SecKey fp else return $ Nothing+ | otherwise = Nothing++-- | Create internal public key from raw 64-byte 'ByteString'. Unsafe!+unsafePubKey :: ByteString -> Maybe PubKey+unsafePubKey bs+ | BS.length bs == 64 = unsafePerformIO $ do+ fp <- mallocForeignPtr+ withForeignPtr fp $ \p -> poke p (PubKey64 bs)+ return $ Just $ PubKey fp+ | otherwise = Nothing++-- | Create internal signature from raw 64-byte 'ByteString'. Unsafe!+unsafeSig :: ByteString -> Maybe Sig+unsafeSig bs+ | BS.length bs == 64 = unsafePerformIO $ do+ fp <- mallocForeignPtr+ withForeignPtr fp $ \p -> poke p (Sig64 bs)+ return $ Just $ Sig fp | otherwise = Nothing -- | Create internal tweak data from 32-byte 'ByteString'.