Copyright | Copyright © 2021 Lars Kuhtz <lakuhtz@gmail.com> |
---|---|
License | MIT |
Maintainer | Lars Kuhtz <lakuhtz@gmail.com> |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Data.Hash.Internal.OpenSSL
Description
Bindings for OpenSSL EVP Message Digest Routines
Synopsis
- newtype Algorithm = Algorithm (Ptr Void)
- newtype Ctx a = Ctx (ForeignPtr Void)
- newtype Digest a = Digest ShortByteString
- newCtx :: IO (Ctx a)
- initCtx :: Algorithm -> IO (Ctx a)
- updateCtx :: Ctx a -> Ptr Word8 -> Int -> IO ()
- finalCtx :: Ctx a -> IO (Digest a)
- class OpenSslDigest a where
- newtype OpenSslException = OpenSslException String
- newtype Sha2_224 = Sha2_224 ShortByteString
- newtype Sha2_256 = Sha2_256 ShortByteString
- newtype Sha2_384 = Sha2_384 ShortByteString
- newtype Sha2_512 = Sha2_512 ShortByteString
- newtype Sha2_512_224 = Sha2_512_224 ShortByteString
- newtype Sha2_512_256 = Sha2_512_256 ShortByteString
- newtype Sha3_224 = Sha3_224 ShortByteString
- newtype Sha3_256 = Sha3_256 ShortByteString
- newtype Sha3_384 = Sha3_384 ShortByteString
- newtype Sha3_512 = Sha3_512 ShortByteString
- newtype Shake128 = Shake128 ShortByteString
- newtype Shake256 = Shake256 ShortByteString
- newtype Keccak256 = Keccak256 ShortByteString
- newtype Keccak512 = Keccak512 ShortByteString
- newtype Blake2b512 = Blake2b512 ShortByteString
- newtype Blake2s256 = Blake2s256 ShortByteString
EVP digest routines
Constructors
Digest ShortByteString |
Instances
Eq (Digest a) Source # | |
Ord (Digest a) Source # | |
Defined in Data.Hash.Internal.OpenSSL | |
Show (Digest a) Source # | |
OpenSslDigest a => IncrementalHash (Digest a) Source # | |
OpenSslDigest a => Hash (Digest a) Source # | |
Defined in Data.Hash.Internal.OpenSSL | |
type Context (Digest a) Source # | |
Defined in Data.Hash.Internal.OpenSSL |
Algorithms
class OpenSslDigest a where Source #
Instances
OpenSslDigest Blake2s256 Source # | |
Defined in Data.Hash.Internal.OpenSSL | |
OpenSslDigest Blake2b512 Source # | |
Defined in Data.Hash.Internal.OpenSSL | |
OpenSslDigest Shake256 Source # | |
Defined in Data.Hash.Internal.OpenSSL | |
OpenSslDigest Shake128 Source # | |
Defined in Data.Hash.Internal.OpenSSL | |
OpenSslDigest Sha3_512 Source # | |
Defined in Data.Hash.Internal.OpenSSL | |
OpenSslDigest Sha3_384 Source # | |
Defined in Data.Hash.Internal.OpenSSL | |
OpenSslDigest Sha3_256 Source # | |
Defined in Data.Hash.Internal.OpenSSL | |
OpenSslDigest Sha3_224 Source # | |
Defined in Data.Hash.Internal.OpenSSL | |
OpenSslDigest Sha2_512_256 Source # | |
Defined in Data.Hash.Internal.OpenSSL | |
OpenSslDigest Sha2_512_224 Source # | |
Defined in Data.Hash.Internal.OpenSSL | |
OpenSslDigest Sha2_512 Source # | |
Defined in Data.Hash.Internal.OpenSSL | |
OpenSslDigest Sha2_384 Source # | |
Defined in Data.Hash.Internal.OpenSSL | |
OpenSslDigest Sha2_256 Source # | |
Defined in Data.Hash.Internal.OpenSSL | |
OpenSslDigest Sha2_224 Source # | |
Defined in Data.Hash.Internal.OpenSSL |
newtype OpenSslException Source #
Constructors
OpenSslException String |
Instances
Show OpenSslException Source # | |
Defined in Data.Hash.Internal.OpenSSL Methods showsPrec :: Int -> OpenSslException -> ShowS # show :: OpenSslException -> String # showList :: [OpenSslException] -> ShowS # | |
Exception OpenSslException Source # | |
Defined in Data.Hash.Internal.OpenSSL Methods toException :: OpenSslException -> SomeException # |
SHA2
SHA-2 (Secure Hash Algorithm 2) is a family of cryptographic hash functions standardized in NIST FIPS 180-4, first published in 2001. These functions conform to NIST FIPS 180-4.
The following hash functions from the SHA-2 family are supported in openssl-3.0 (cf. https://www.openssl.org/docs/man3.0/man3/EVP_sha224.html)
EVP_sha224, EVP_sha256, EVP_sha512_224, EVP_sha512_256, EVP_sha384, EVP_sha512
Constructors
Sha2_224 ShortByteString |
Instances
Constructors
Sha2_256 ShortByteString |
Instances
Constructors
Sha2_384 ShortByteString |
Instances
Constructors
Sha2_512 ShortByteString |
Instances
newtype Sha2_512_224 Source #
Constructors
Sha2_512_224 ShortByteString |
Instances
newtype Sha2_512_256 Source #
Constructors
Sha2_512_256 ShortByteString |
Instances
SHA3
SHA-3 (Secure Hash Algorithm 3) is a family of cryptographic hash functions standardized in NIST FIPS 202, first published in 2015. It is based on the Keccak algorithm. These functions conform to NIST FIPS 202.
The following hash functions from the SHA-3 family are supported in openssl-3.0 (cf. https://www.openssl.org/docs/man3.0/man3/EVP_sha3_224.html)
EVP_sha3_224, EVP_sha3_256, EVP_sha3_384, EVP_sha3_512, EVP_shake128, EVP_shake256
Constructors
Sha3_224 ShortByteString |
Instances
Constructors
Sha3_256 ShortByteString |
Instances
Constructors
Sha3_384 ShortByteString |
Instances
Constructors
Sha3_512 ShortByteString |
Instances
Constructors
Shake128 ShortByteString |
Instances
Constructors
Shake256 ShortByteString |
Instances
Keccak
This is the latest version of Keccak-256 hash function that was submitted to the SHA3 competition. It is different from the final NIST SHA3 hash.
The difference between NIST SHA3-256 and Keccak-256 is the use of a different padding character for the input message. The former uses '0x06' and the latter uses '0x01'.
This version of Keccak-256 is used by the Ethereum project.
This implementation of Keccak-256 uses internal OpenSSL APIs. It may break with new versions of OpenSSL. It may also be broken for existing versions of OpenSSL. Portability of the code is unknown.
ONLY USE THIS CODE AFTER YOU HAVE VERIFIED THAT IT WORKS WITH OUR VERSION OF OPENSSL.
For details see the file cbits/keccak.c.
Constructors
Keccak256 ShortByteString |
Instances
Eq Keccak256 Source # | |
Ord Keccak256 Source # | |
Show Keccak256 Source # | |
IncrementalHash Keccak256 Source # | |
Hash Keccak256 Source # | |
Defined in Data.Hash.Internal.OpenSSL | |
type Context Keccak256 Source # | |
Defined in Data.Hash.Internal.OpenSSL |
Constructors
Keccak512 ShortByteString |
Instances
Eq Keccak512 Source # | |
Ord Keccak512 Source # | |
Show Keccak512 Source # | |
IncrementalHash Keccak512 Source # | |
Hash Keccak512 Source # | |
Defined in Data.Hash.Internal.OpenSSL | |
type Context Keccak512 Source # | |
Defined in Data.Hash.Internal.OpenSSL |
Blake2
BLAKE2 is an improved version of BLAKE, which was submitted to the NIST SHA-3 algorithm competition. The BLAKE2s and BLAKE2b algorithms are described in RFC 7693.
The following hash functions from the BLAKE2 family are supported in openssl-3.0 (cf. https://www.openssl.org/docs/man3.0/man3/EVP_blake2b512.html)
EVP_blake2b512, EVP_blake2s256
While the BLAKE2b and BLAKE2s algorithms supports a variable length digest, this implementation outputs a digest of a fixed length (the maximum length supported), which is 512-bits for BLAKE2b and 256-bits for BLAKE2s.
newtype Blake2b512 Source #
Constructors
Blake2b512 ShortByteString |
Instances
Eq Blake2b512 Source # | |
Defined in Data.Hash.Internal.OpenSSL | |
Ord Blake2b512 Source # | |
Defined in Data.Hash.Internal.OpenSSL Methods compare :: Blake2b512 -> Blake2b512 -> Ordering # (<) :: Blake2b512 -> Blake2b512 -> Bool # (<=) :: Blake2b512 -> Blake2b512 -> Bool # (>) :: Blake2b512 -> Blake2b512 -> Bool # (>=) :: Blake2b512 -> Blake2b512 -> Bool # max :: Blake2b512 -> Blake2b512 -> Blake2b512 # min :: Blake2b512 -> Blake2b512 -> Blake2b512 # | |
Show Blake2b512 Source # | |
Defined in Data.Hash.Internal.OpenSSL Methods showsPrec :: Int -> Blake2b512 -> ShowS # show :: Blake2b512 -> String # showList :: [Blake2b512] -> ShowS # | |
IncrementalHash Blake2b512 Source # | |
Defined in Data.Hash.Internal.OpenSSL Associated Types type Context Blake2b512 Source # | |
Hash Blake2b512 Source # | |
Defined in Data.Hash.Internal.OpenSSL Methods initialize :: IO (Context Blake2b512) Source # | |
OpenSslDigest Blake2b512 Source # | |
Defined in Data.Hash.Internal.OpenSSL | |
type Context Blake2b512 Source # | |
Defined in Data.Hash.Internal.OpenSSL |
newtype Blake2s256 Source #
Constructors
Blake2s256 ShortByteString |
Instances
Eq Blake2s256 Source # | |
Defined in Data.Hash.Internal.OpenSSL | |
Ord Blake2s256 Source # | |
Defined in Data.Hash.Internal.OpenSSL Methods compare :: Blake2s256 -> Blake2s256 -> Ordering # (<) :: Blake2s256 -> Blake2s256 -> Bool # (<=) :: Blake2s256 -> Blake2s256 -> Bool # (>) :: Blake2s256 -> Blake2s256 -> Bool # (>=) :: Blake2s256 -> Blake2s256 -> Bool # max :: Blake2s256 -> Blake2s256 -> Blake2s256 # min :: Blake2s256 -> Blake2s256 -> Blake2s256 # | |
Show Blake2s256 Source # | |
Defined in Data.Hash.Internal.OpenSSL Methods showsPrec :: Int -> Blake2s256 -> ShowS # show :: Blake2s256 -> String # showList :: [Blake2s256] -> ShowS # | |
IncrementalHash Blake2s256 Source # | |
Defined in Data.Hash.Internal.OpenSSL Associated Types type Context Blake2s256 Source # | |
Hash Blake2s256 Source # | |
Defined in Data.Hash.Internal.OpenSSL Methods initialize :: IO (Context Blake2s256) Source # | |
OpenSslDigest Blake2s256 Source # | |
Defined in Data.Hash.Internal.OpenSSL | |
type Context Blake2s256 Source # | |
Defined in Data.Hash.Internal.OpenSSL |