Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data MessageHash
- toMessageHash ∷ ByteString → Maybe MessageHash
- fromMessageHash ∷ MessageHash → ByteString
- hashAndPack ∷ ∀ (h ∷ Type). (HashAlgorithm h, SizeHash h ~ SECP256K1_ECDSA_MESSAGE_BYTES) ⇒ Proxy h → ByteString → MessageHash
- data EcdsaSecp256k1DSIGN
- data family VerKeyDSIGN v ∷ Type
- data family SignKeyDSIGN v ∷ Type
- data family SigDSIGN v ∷ Type
Documentation
data MessageHash Source #
As ECDSA signatures on the SECP256k1 curve sign 32-byte hashes, rather than whole messages, we provide a helper (opaque) newtype to ensure that the size of the input for signing and verification is strictly bounded.
Important note
If you are verifying a message using the algorithm provided here, you should hash the message yourself before verifying. Specifically, the sender should give you the message itself to verify, rather than the hash of the message used to compute the signature.
Instances
Show MessageHash Source # | |
Defined in Cardano.Crypto.DSIGN.EcdsaSecp256k1 | |
Eq MessageHash Source # | |
Defined in Cardano.Crypto.DSIGN.EcdsaSecp256k1 (==) ∷ MessageHash → MessageHash → Bool Source # (/=) ∷ MessageHash → MessageHash → Bool Source # |
toMessageHash ∷ ByteString → Maybe MessageHash Source #
Take a blob of bytes (which is presumed to be a 32-byte hash), verify its
length, and package it into a MessageHash
if that length is exactly 32.
fromMessageHash ∷ MessageHash → ByteString Source #
Turn a MessageHash
into its bytes without a length marker.
hashAndPack ∷ ∀ (h ∷ Type). (HashAlgorithm h, SizeHash h ~ SECP256K1_ECDSA_MESSAGE_BYTES) ⇒ Proxy h → ByteString → MessageHash Source #
A helper to use with the HashAlgorithm
API, as this can ensure sizing.
data EcdsaSecp256k1DSIGN Source #
Instances
data family VerKeyDSIGN v ∷ Type Source #
Instances
data family SignKeyDSIGN v ∷ Type Source #
Instances
data family SigDSIGN v ∷ Type Source #