sha256

Pure Haskell SHA-256, HMAC-SHA256 (docs.ppad.tech/sha256).
git clone git://git.ppad.tech/sha256.git
Log | Files | Refs | README | LICENSE

CHANGELOG (3363B)


      1 # Changelog
      2 
      3 - 0.3.6 (2026-10-31)
      4   * Uses the x86 SHA extensions on x86_64 CPUs that support them,
      5     detected at runtime, falling back to the pure Haskell
      6     implementation elsewhere. 'hash' and 'hmac' on such CPUs are
      7     roughly 2-4x faster.
      8 
      9 - 0.3.5 (2026-10-10)
     10   * Further defends MAC comparison timing against "helpful" LLVM
     11     optimizations.
     12   * Detects support for the ARM SHA2 extensions at runtime, rather than
     13     assuming it on all aarch64 builds, which crashed on aarch64 CPUs
     14     lacking them.
     15   * The portable implementation now lives in an internal
     16     'Crypto.Hash.SHA256.Pure' module, and
     17     'Crypto.Hash.SHA256.Arm' is no longer exposed. Both are hidden
     18     internal modules; the public API is unchanged.
     19   * Improves 'hash_lazy' and 'hmac_lazy' performance.
     20 
     21 - 0.3.4 (2026-07-06)
     22   * Reverts the unrolled MAC comparison introduced in 0.3.3, which was
     23     found to introduce timing variation on both aarch64 and x86-64 when
     24     compiled via the LLVM backend (the NCG backend was unaffected).
     25 
     26 - 0.3.3 (2026-07-06)
     27   * The constant-time 'Eq' on 'MAC' now folds over the two buffers
     28     directly, rather than materialising an intermediate ByteString
     29     holding their XOR on the heap. Semantics are unchanged.
     30 
     31   * Improves the performance of constant-time MAC comparison.
     32 
     33 - 0.3.2 (2026-02-01)
     34   * The library has been refactored substantially to achieve greater
     35     control over heap allocation, particularly around HMAC calculation.
     36 
     37   * A couple of very low-level functions, '_hmac_rr' and '_hmac_rsb' are
     38     now quietly exported for calculating specialized destructive HMAC
     39     operations, mostly of use to HMAC-DRBG implementations.
     40 
     41   * HMAC performance is also improved, now only about 2x that of hash
     42     computation.
     43 
     44 - 0.3.1 (2026-01-11)
     45   * Adds a basic quickcheck test suite for asserting memory safety of
     46     library functions on random inputs.
     47 
     48 - 0.3.0 (2026-01-10)
     49   * The HMAC functions now produce a value of type MAC, which is a
     50     newtype over a ByteString. The 'Eq' instance for MAC compares values
     51     in constant time.
     52 
     53 - 0.2.5 (2026-01-08)
     54   * We now check if the ARM cryptographic extensions are available, and,
     55     if so, use them to calculate hashes. If they're unavailable we
     56     simply use the pure implementation as a fallback. This yields about
     57     a 5x performance boost for 'hash' and 3.5x boost for 'hmac' (again,
     58     when available).
     59 
     60   * Allocation for both the 'hash' and 'hmac' functions has been reduced
     61     dramatically, mostly by optimising the padding internals, and is now
     62     constant with respect to input.
     63 
     64 - 0.2.4 (2025-12-28)
     65   * Adds an 'llvm' build flag and tests with GHC 9.10.3.
     66 
     67 - 0.2.3 (2025-01-21)
     68   * Improves padding handling for the strict bytestring case, yielding
     69     performance increases for both 'hash' and 'hmac'.
     70 
     71 - 0.2.2 (2025-01-07)
     72   * Minor bytestring-handling optimisations.
     73 
     74 - 0.2.1 (2024-10-13)
     75   * Adds an INLINE pragma to an internal step function.
     76 
     77   * 'hmac' no longer calls 'hmac_lazy', which has no practical effect
     78     other than to clean up profiling reports generated by GHC.
     79 
     80 - 0.2.0 (2024-10-07)
     81   * 'hmac' and 'hmac_lazy' now hash long keys before computing a HMAC,
     82     instead of throwing an error, matching RFC 2104's suggested behaviour.
     83 
     84 - 0.1.0 (2024-09-14)
     85   * Initial release, supporting SHA256 and HMAC-SHA256 on strict and lazy
     86     bytestrings.