packages feed

hwsl2-0.3.2.0: hwsl2.cabal

-- Initial hwsl2.cabal generated by cabal init.  For further documentation,
--  see http://haskell.org/cabal/users-guide/

-- The name of the package.
name:                hwsl2

-- The package version.  See the Haskell package versioning policy (PVP)
-- for standards guiding when and how versions should be incremented.
-- http://www.haskell.org/haskellwiki/Package_versioning_policy
-- PVP summary:      +-+------- breaking API changes
--                   | | +----- non-breaking API additions
--                   | | | +--- code changes with no API change
version:             0.3.2.0

-- A short (one-line) description of the package.
synopsis:            Hashing with SL2

-- A longer description of the package.
description:
  An algebraic hash function, inspired by the paper /Hashing with SL2/ by Tillich and Zemor.
  .
  The hash function is based on matrix multiplication in the special linear group
  of degree 2, over a Galois field of order 2^127,  with all computations modulo
  the polynomial x^127 + x^63 + 1.
  .
  This construction gives some nice properties, which traditional bit-scambling
  hash functions don't possess, including it being composable. It holds:
  .
  > hash (m1 <> m2) == hash m1 <> hash m2
  .
  Following that, the hash function is also parallelisable. If a message can be divided
  into a list of chunks, the hash of the message can be calculated in parallel:
  .
  > mconcat (parMap rpar hash chunks)
  .
  All operations in this package are implemented in a very efficient manner using SSE instructions.

-- URL for the project homepage or repository.
homepage:            https://github.com/srijs/hwsl2

-- The license under which the package is released.
license:             MIT

-- The file containing the license text.
license-file:        LICENSE

-- The package author(s).
author:              Sam Rijs

-- An email address to which users can send suggestions, bug reports, and
-- patches.
maintainer:          srijs@airpost.net

-- A copyright notice.
-- copyright:

category:            Data

build-type:          Simple

-- Extra files to be distributed with the package, such as examples or a
-- README.
extra-source-files:  README.md
                     src/core/sl2-inl.h src/core/gf2p127-inl.h

-- Constraint on the version of Cabal needed to build this package.
cabal-version:       >=1.10

flag avx2
  description:        Enable AVX 2 optimisations.
  default:            False

library
  -- Modules exported by the library.
  exposed-modules:     Data.Hash.SL2
                       Data.Hash.SL2.Chunk
                       Data.Hash.SL2.Mutable
                       Data.Hash.SL2.Unsafe

  -- Modules included in this library but not exported.
  other-modules:       Data.Hash.SL2.Internal

  -- LANGUAGE extensions used by modules in this package.
  other-extensions:    ForeignFunctionInterface CApiFFI
                       Safe Trustworthy Unsafe

  -- Other library packages from which modules are imported.
  build-depends:       base >=4.7 && <4.8, bytestring >=0.10 && <0.11

  -- Directories containing source files.
  hs-source-dirs:      src

  ghc-options:         -fwarn-unused-imports

  -- Options for foreign source files.
  include-dirs:        src/core
  if flag(avx2)
    cc-options:        -Wall -O3 -mavx2 -msse4.1 -msse2 -mpclmul
    ghc-options:       -O3 -optc-mavx2 -optc-msse4.1 -msse2 -optc-mpclmul
  else
    cc-options:        -Wall -O3 -msse4.1 -msse2 -mpclmul
    ghc-options:       -O3 -optc-msse4.1 -msse2 -optc-mpclmul

  -- Base language which the package is written in.
  default-language:    Haskell2010


test-suite test
  type:                detailed-0.9
  hs-source-dirs:      src
  test-module:         Data.Hash.SL2.Test
  other-modules:       Data.Hash.SL2
                       Data.Hash.SL2.Mutable
                       Data.Hash.SL2.Unsafe
                       Data.Hash.SL2.Internal
  build-depends:       base >=4.7 && <4.8,
                       Cabal >=1.9.2,
                       bytestring >=0.10 && <0.11,
                       QuickCheck >=2.7 && <2.8,
                       quickcheck-properties>=0.1 && <0.2,
                       cabal-test-quickcheck>=0.1 && <0.2
  include-dirs:        src/core
  if flag(avx2)
    cc-options:        -Wall -O3 -mavx2 -msse4.1 -msse2 -mpclmul
    ghc-options:       -O3 -optc-mavx2 -optc-msse4.1 -msse2 -optc-mpclmul
  else
    cc-options:        -Wall -O3 -msse4.1 -msse2 -mpclmul
    ghc-options:       -O3 -optc-msse4.1 -msse2 -optc-mpclmul

benchmark bench
  type:                exitcode-stdio-1.0
  hs-source-dirs:      src
  main-is:             Data/Hash/SL2/Benchmark.hs
  other-modules:       Data.Hash.SL2
                       Data.Hash.SL2.Mutable
                       Data.Hash.SL2.Unsafe
                       Data.Hash.SL2.Internal
  build-depends:       base >=4.7 && <4.8,
                       Cabal >=1.9.2,
                       bytestring >=0.10 && <0.11,
                       criterion >=1.0 && <1.1,
                       cryptohash >=0.11 && <0.12,
                       parallel >=3.2 && <3.3
  include-dirs:        src/core
  if flag(avx2)
    cc-options:        -Wall -O3 -mavx2 -msse4.1 -msse2 -mpclmul
    ghc-options:       -rtsopts -threaded -O3 -optc-mavx2 -optc-msse4.1 -msse2 -optc-mpclmul
  else
    cc-options:        -Wall -O3 -msse4.1 -msse2 -mpclmul
    ghc-options:       -rtsopts -threaded -O3 -optc-msse4.1 -msse2 -optc-mpclmul