packages feed

hashes-0.2.1.0: hashes.cabal

cabal-version: 2.4
name: hashes
version: 0.2.1.0
synopsis: Hash functions
Description: Efficient implementations of hash functions
homepage: https://github.com/larskuhtz/hs-hashes
bug-reports: https://github.com/larskuhtz/hs-hashes/issues
license: MIT
license-file: LICENSE
author: Lars Kuhtz
maintainer: lakuhtz@gmail.com
copyright: Copyright (c) 2019-2021 Lars Kuhtz <lakuhtz@gmail.com>
category: Data
tested-with:
    GHC==9.0.1
    GHC==8.10.7
    GHC==8.8.4
extra-source-files:
    README.md
    CHANGELOG.md
    cbits/keccak.h
    cbits/keccak.c
    cbits/keccak-example.c

source-repository head
    type: git
    location: https://github.com/larskuhtz/hs-hashes.git

flag with-openssl
    description:
        Include cryptograph hash functions from openssl. Requires that openssl
        is installed in the system at a location where cabal can find it.
    default: True
    manual: True

flag benchmark-cryptonite
    description: Include implementations from the cryptonite package in benchmarks
    default: False
    manual: True

flag test-cryptonite
    description: Test compatibility with implementations of hash functions in cryptonite
    default: False
    manual: True

flag openssl-use-pkg-config
    description: Use pkg-config to find OpenSSL (macOS and linux only).
    default: False
    manual: True

common openssl-common
    if flag(with-openssl)
        c-sources:
            cbits/keccak.h
            cbits/keccak.c
        cpp-options: -DWITH_OPENSSL=1
        include-dirs:
            /usr/local/opt/openssl@3/include
            /usr/local/opt/openssl/include
            /opt/local/include
        extra-lib-dirs:
            /usr/local/opt/openssl@3/lib/
            /usr/local/opt/openssl/lib/
            /opt/local/lib
        if flag(openssl-use-pkg-config)
            pkgconfig-depends: libcrypto
        else
            extra-Libraries: crypto

library
    import: openssl-common
    hs-source-dirs: src
    default-language: Haskell2010
    exposed-modules:
        Data.Hash.Class.Mutable
        Data.Hash.Class.Mutable.Internal
        Data.Hash.Class.Mutable.Salted
        Data.Hash.Class.Pure
        Data.Hash.Class.Pure.Internal
        Data.Hash.Class.Pure.Salted
        Data.Hash.FNV1
        Data.Hash.FNV1.Salted
        Data.Hash.Internal.Utils
        Data.Hash.SipHash
    if flag(with-openssl)
        exposed-modules:
            Data.Hash.Blake2
            Data.Hash.Internal.OpenSSL
            Data.Hash.Keccak
            Data.Hash.SHA2
            Data.Hash.SHA3
    ghc-options:
        -mbmi2
        -msse4.2
    build-depends:
        , base >=4.11 && <5
        , bytestring >=0.10

test-suite tests
    import: openssl-common
    type: exitcode-stdio-1.0
    hs-source-dirs: test
    default-language: Haskell2010
    ghc-options:
        -rtsopts
        -threaded
        -with-rtsopts=-N
    main-is: Main.hs
    other-modules:
        Test.Data.Hash.SipHash
        Test.Data.Hash.FNV1
        Test.Data.Hash.Class.Pure
    build-depends:
        -- internal
        , hashes
        -- external
        , QuickCheck >= 2.13
        , base >=4.11 && <5
        , bytestring >=0.10
        , sydtest >=0.4

    if flag(test-cryptonite)
        build-depends:
            , memory >=0.14
            , cryptonite >=0.29
        cpp-options: -DTEST_CRYPTONITE=1
        other-modules:
            Cryptonite

benchmark benchmarks
    import: openssl-common
    type: exitcode-stdio-1.0
    hs-source-dirs: bench
    main-is: Main.hs
    default-language: Haskell2010
    ghc-options:
        -rtsopts
        -threaded
        -with-rtsopts=-N
        -mbmi2
        -msse4.2
    build-depends:
        -- internal
        , hashes

        -- external
        , base >=4.10 && <5
        , bytestring >=0.10
        , criterion >= 1.5

    if flag(benchmark-cryptonite)
        build-depends:
            , memory >=0.14
            , cryptonite >=0.29
        cpp-options: -DBENCHMARK_CRYPTONITE=1