| Copyright | No rights reserved |
|---|---|
| License | MIT |
| Maintainer | jprupp@protonmail.ch |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Haskoin.Crypto.Hash
Contents
Description
Hashing functions and corresponding data types. Uses functions from the cryptonite library.
Synopsis
- data Hash512
- data Hash256
- data Hash160
- data CheckSum32
- sha512 :: ByteArrayAccess b => b -> Hash512
- sha256 :: ByteArrayAccess b => b -> Hash256
- ripemd160 :: ByteArrayAccess b => b -> Hash160
- sha1 :: ByteArrayAccess b => b -> Hash160
- doubleSHA256 :: ByteArrayAccess b => b -> Hash256
- addressHash :: ByteArrayAccess b => b -> Hash160
- checkSum32 :: ByteArrayAccess b => b -> CheckSum32
- hmac512 :: ByteString -> ByteString -> Hash512
- hmac256 :: (ByteArrayAccess k, ByteArrayAccess m) => k -> m -> Hash256
- split512 :: Hash512 -> (Hash256, Hash256)
- join512 :: (Hash256, Hash256) -> Hash512
- initTaggedHash :: ByteString -> Context SHA256
Hashes
Type for 512-bit hashes.
Instances
| IsString Hash512 Source # | |
Defined in Haskoin.Crypto.Hash Methods fromString :: String -> Hash512 # | |
| Generic Hash512 Source # | |
| Read Hash512 Source # | |
| Show Hash512 Source # | |
| Binary Hash512 Source # | |
| Serial Hash512 Source # | |
Defined in Haskoin.Crypto.Hash | |
| Serialize Hash512 Source # | |
| NFData Hash512 Source # | |
Defined in Haskoin.Crypto.Hash | |
| Eq Hash512 Source # | |
| Ord Hash512 Source # | |
| Hashable Hash512 Source # | |
Defined in Haskoin.Crypto.Hash | |
| type Rep Hash512 Source # | |
Defined in Haskoin.Crypto.Hash type Rep Hash512 = D1 ('MetaData "Hash512" "Haskoin.Crypto.Hash" "haskoin-core-1.1.0-EPeWWz60EKPlWai44F9WC" 'True) (C1 ('MetaCons "Hash512" 'PrefixI 'True) (S1 ('MetaSel ('Just "get") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ShortByteString))) | |
Type for 256-bit hashes.
Instances
| IsString Hash256 Source # | |
Defined in Haskoin.Crypto.Hash Methods fromString :: String -> Hash256 # | |
| Generic Hash256 Source # | |
| Read Hash256 Source # | |
| Show Hash256 Source # | |
| Binary Hash256 Source # | |
| Serial Hash256 Source # | |
Defined in Haskoin.Crypto.Hash | |
| Serialize Hash256 Source # | |
| NFData Hash256 Source # | |
Defined in Haskoin.Crypto.Hash | |
| Eq Hash256 Source # | |
| Ord Hash256 Source # | |
| Hashable Hash256 Source # | |
Defined in Haskoin.Crypto.Hash | |
| type Rep Hash256 Source # | |
Defined in Haskoin.Crypto.Hash type Rep Hash256 = D1 ('MetaData "Hash256" "Haskoin.Crypto.Hash" "haskoin-core-1.1.0-EPeWWz60EKPlWai44F9WC" 'True) (C1 ('MetaCons "Hash256" 'PrefixI 'True) (S1 ('MetaSel ('Just "get") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ShortByteString))) | |
Type for 160-bit hashes.
Instances
| IsString Hash160 Source # | |
Defined in Haskoin.Crypto.Hash Methods fromString :: String -> Hash160 # | |
| Generic Hash160 Source # | |
| Read Hash160 Source # | |
| Show Hash160 Source # | |
| Binary Hash160 Source # | |
| Serial Hash160 Source # | |
Defined in Haskoin.Crypto.Hash | |
| Serialize Hash160 Source # | |
| NFData Hash160 Source # | |
Defined in Haskoin.Crypto.Hash | |
| Eq Hash160 Source # | |
| Ord Hash160 Source # | |
| Hashable Hash160 Source # | |
Defined in Haskoin.Crypto.Hash | |
| type Rep Hash160 Source # | |
Defined in Haskoin.Crypto.Hash type Rep Hash160 = D1 ('MetaData "Hash160" "Haskoin.Crypto.Hash" "haskoin-core-1.1.0-EPeWWz60EKPlWai44F9WC" 'True) (C1 ('MetaCons "Hash160" 'PrefixI 'True) (S1 ('MetaSel ('Just "get") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ShortByteString))) | |
data CheckSum32 Source #
Word32 wrapped for type-safe 32-bit checksums.
Instances
sha512 :: ByteArrayAccess b => b -> Hash512 Source #
Calculate SHA512 hash.
sha256 :: ByteArrayAccess b => b -> Hash256 Source #
Calculate SHA256 hash.
ripemd160 :: ByteArrayAccess b => b -> Hash160 Source #
Calculate RIPEMD160 hash.
sha1 :: ByteArrayAccess b => b -> Hash160 Source #
Claculate SHA1 hash.
doubleSHA256 :: ByteArrayAccess b => b -> Hash256 Source #
Compute two rounds of SHA-256.
addressHash :: ByteArrayAccess b => b -> Hash160 Source #
Compute SHA-256 followed by RIPMED-160.
checkSum32 :: ByteArrayAccess b => b -> CheckSum32 Source #
Computes a 32 bit checksum.
hmac512 :: ByteString -> ByteString -> Hash512 Source #
Computes HMAC over SHA-512.
hmac256 :: (ByteArrayAccess k, ByteArrayAccess m) => k -> m -> Hash256 Source #
Computes HMAC over SHA-256.
Arguments
| :: ByteString | Hash tag |
| -> Context SHA256 |
Initialize tagged hash specified in BIP340
Since: 0.21.0