| Copyright | No rights reserved |
|---|---|
| License | MIT |
| Maintainer | jprupp@protonmail.ch |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
| 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
Type for 256-bit hashes.
Instances
| IsString Hash256 Source # | |||||
Defined in Haskoin.Crypto.Hash Methods fromString :: String -> Hash256 # | |||||
| Generic Hash256 Source # | |||||
Defined in Haskoin.Crypto.Hash Associated Types
| |||||
| 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.2.2-IqsPTB3lyDG9ChtLlvwlSX" '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 # | |||||
Defined in Haskoin.Crypto.Hash Associated Types
| |||||
| 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.2.2-IqsPTB3lyDG9ChtLlvwlSX" '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
| Generic CheckSum32 Source # | |||||
Defined in Haskoin.Crypto.Hash Associated Types
| |||||
| Read CheckSum32 Source # | |||||
Defined in Haskoin.Crypto.Hash Methods readsPrec :: Int -> ReadS CheckSum32 # readList :: ReadS [CheckSum32] # readPrec :: ReadPrec CheckSum32 # readListPrec :: ReadPrec [CheckSum32] # | |||||
| Show CheckSum32 Source # | |||||
Defined in Haskoin.Crypto.Hash Methods showsPrec :: Int -> CheckSum32 -> ShowS # show :: CheckSum32 -> String # showList :: [CheckSum32] -> ShowS # | |||||
| Binary CheckSum32 Source # | |||||
Defined in Haskoin.Crypto.Hash | |||||
| Serial CheckSum32 Source # | |||||
Defined in Haskoin.Crypto.Hash | |||||
| Serialize CheckSum32 Source # | |||||
Defined in Haskoin.Crypto.Hash | |||||
| NFData CheckSum32 Source # | |||||
Defined in Haskoin.Crypto.Hash Methods rnf :: CheckSum32 -> () # | |||||
| Eq CheckSum32 Source # | |||||
Defined in Haskoin.Crypto.Hash | |||||
| Ord CheckSum32 Source # | |||||
Defined in Haskoin.Crypto.Hash Methods compare :: CheckSum32 -> CheckSum32 -> Ordering # (<) :: CheckSum32 -> CheckSum32 -> Bool # (<=) :: CheckSum32 -> CheckSum32 -> Bool # (>) :: CheckSum32 -> CheckSum32 -> Bool # (>=) :: CheckSum32 -> CheckSum32 -> Bool # max :: CheckSum32 -> CheckSum32 -> CheckSum32 # min :: CheckSum32 -> CheckSum32 -> CheckSum32 # | |||||
| Hashable CheckSum32 Source # | |||||
Defined in Haskoin.Crypto.Hash | |||||
| type Rep CheckSum32 Source # | |||||
Defined in Haskoin.Crypto.Hash type Rep CheckSum32 = D1 ('MetaData "CheckSum32" "Haskoin.Crypto.Hash" "haskoin-core-1.2.2-IqsPTB3lyDG9ChtLlvwlSX" 'True) (C1 ('MetaCons "CheckSum32" 'PrefixI 'True) (S1 ('MetaSel ('Just "get") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word32))) | |||||
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