hashable
A class for types that can be converted to a hash value
http://github.com/haskell-unordered-containers/hashable
| LTS Haskell 24.17: | 1.5.0.0@rev:1 | 
| Stackage Nightly 2025-10-31: | 1.5.0.0@rev:1 | 
| Latest on Hackage: | 1.5.0.0@rev:1 | 
hashable-1.5.0.0@sha256:2f23146cbe0325029927b221647695a4c7d6e97548ff731110979e34361f58ef,5914Module documentation for 1.5.0.0
The hashable package
This package defines a class, Hashable, for types that can be
converted to a hash value.  This class exists for the benefit of
hashing-based data structures.  The package provides instances for
basic types and a way to combine hash values.
Changes
See also https://pvp.haskell.org/faq
Version 1.5.0.0
- Add QuantifiedConstraintssuperclasses toHashable1/2:
class (Eq1 t, forall a. Hashable a => Hashable (t a)) => Hashable1 t where
class (Eq2 t, forall a. Hashable a => Hashable1 (t a)) => Hashable2 t where
- 
Change contexts of Compose,ProductandSuminstances. This and above is the similar change as CLC proposal #10
- 
The above changes require base-4.18.0.0, so we drop support for GHC prior GHC-9.6.5 (Thehashable-1.4branch will be maintained for time being for older GHC users).
- 
Make Arg a binstance behave asHashable ainstance.
Version 1.4.7.0
- Make arch-nativedisabled by default.
Version 1.4.6.0
- Use GND&DerivingVia to derive newtypeintances (Data.Semigroup,Data.Monoid,Identityetc).
Version 1.4.5.0
- Drop support for GHCs prior 8.6.5
- Use xxhash for hashing bytestrings and bytearrays.
Note: when compiling binaries for distribution, you may need to disable
arch-nativeflag.
Version 1.4.4.0
- Depend on os-string-2for GHC-9.2+
- Support filepath-1.5
Version 1.4.3.0
- Export defaultHashWithSaltanddefaultHash.
- Fix issue of tuples with 0 first component causing all-zero state.
- Change hashIntto mix bits more.
Version 1.4.2.0
- Fix the foreign signature of getThreadIdhttps://github.com/haskell-unordered-containers/hashable/pull/263
- Drop support for GHCs prior GHC-8.2
The recent unordered-containersreleases support only GHC-8.2+
- Add instance for OsString,PosixString,WindowsStringfromfilepath-1.4.100.1
- Add Hashable ByteArrayinstance usingdata-array-bytecompat package
Version 1.4.1.0
- Add instance for Data.Array.Byte.ByteArray.
Version 1.4.0.2
- Restore older GHC support
- Support GHC-9.0.2
Version 1.4.0.1
- text-2.0compatibility
Version 1.4.0.0
- 
Eqis now a superclass ofHashable. AlsoEq1is a superclass ofHashable1andEq2is a superclass ofHashable2when exists.
- 
Remove Hashable1 Fixedinstance
- 
Remove Hashable1 Semi.Min/Max/...instances as they don’t haveEq1instance.
Version 1.3.5.0
- Add Soloinstance (base-4.15+, GHC-9+)
Version 1.3.4.1
- Fix compilation on 32 bit platforms
- Fix Treeinstance
Version 1.3.4.0
- Textand- ByteStringhashes include length. This fixes a variant of https://github.com/haskell-unordered-containers/hashable/issues/74 for texts and bytestrings. https://github.com/haskell-unordered-containers/hashable/pull/223
- Use correct prime in combine. This should improve the hash quality of compound structures on 64bit systems. https://github.com/haskell-unordered-containers/hashable/pull/224
- Add instance for types in containerspackage https://github.com/haskell-unordered-containers/hashable/pull/226
- Change Int,Int64andWord64hashWithSaltslightly. https://github.com/haskell-unordered-containers/hashable/pull/227
Version 1.3.3.0
- Texthashing uses 64-bit FNV prime
- Don’t truncate Text hashvalues on 64bit Windows: https://github.com/haskell-unordered-containers/hashable/pull/211
Version 1.3.2.0
- Add Hashable (Fixed a)forbase <4.7versions.
- Add documentation:
- hashableis not a stable hash
- hashWithSaltmay return negative values
- there is time-compatwithHashableinstances fortimetypes.
 
- Add random-initial-seedflag causing the initial seed to be randomized on each start of an executable usinghashable.
Version 1.3.1.0
- 
Add Hashable1instances tosemigroupstypes.
- 
Use ghc-bignumwith GHC-9.0
- 
Use FNV-1 constants. 
- 
Make hashable-examplesa test-suite
Version 1.3.0.0
- 
Semantic change of Hashable Arginstance to not hash the second argument ofArgin order to be consistent withEq Arg(#171)
- 
Semantic change of Hashable FloatandHashable Doubleinstances to hash-0.0and0.0to the same value (#173)
- 
Add Hashableinstance forFingerprint(#156)
- 
Add new Data.Hashable.Genericmodule providing the default implementationsgenericHashWithSaltandgenericLiftHashWithSalttogether with other Generics support helpers (#148, #178)
- 
Bump minimum version requirement of basetobase-4.5(i.e. GHC >= 7.4)
Version 1.2.7.0
- 
Add HashableandHashable1instances forComplex
- 
Fix undefined behavior in hashable_fn_hash()implementation due to signed integer overflow (#152)
- 
Mark Data.Hashable.LiftedasTrustworthy(re SafeHaskell)
- 
Support GHC 8.4 
Version 1.2.6.1
- 
Use typeRepFingerprint from Type.Reflection.Unsafe 
- 
Bump minimum version of base to 4.4. 
Version 1.2.6.0
- 
Add support for type-indexed Typeable.
- 
Rework the Generichashable for sums.
Version 1.2.5.0
- 
Add Hashable1andHashable2
- 
Add instances for: Eq1,Ord1,Show1,Ptr,FunPtr,IntPtr,WordPtr
- 
Add Hashedtype for caching thehashfunction result.
Version 1.2.4.0
- 
Add instances for: Unique, Version, Fixed, NonEmpty, Min, Max, Arg, First, Last, WrappedMonoid, Option 
- 
Support GHC 8.0 
Version 1.2.3.3
- Support integer-simple.
Version 1.2.3.2
- Add support for GHC 7.10 typeRepFingerprint
Version 1.2.3.1
- Added support for random 1.1.*.
Version 1.2.3.0
- 
Silence integer literal overflow warning 
- 
Add support for GHC 7.10 integer-gmp2&Natural
- 
Add instance for Data.Void 
- 
Make the SSE .cabal flags manual 
- 
Add an upper bound on bytestring 
Version 1.2.2.0
- 
Add instances for Data.ByteString.Short
- 
Use a 32-bit default salt on 32-bit archs. 
Version 1.2.1.0
- 
Revert instances to their 1.1 implementations to regain the performance we had then. 
- 
Remove use of random salt altogether. Without using SipHash the benefit is unclear (i.e. collision attacks still work) and the complexity is no longer worth it. 
- 
Documentation improvements. 
Version 1.2.0.10
- Fix for GHC 7.0.
Version 1.2.0.9
- 
Stop using SipHash. The current implementation still has segfault causing bugs that we won’t be able to fix soon. 
- 
Stop using Wang hash. It degrades performance of fixed-size integer hashing too much. 
Version 1.2.0.8
- 
Fix linking issue when SSE was disabled. 
- 
Hash small signed Integers correctly. 
Version 1.2.0.7
- Add flags to control usage of SSE.
Version 1.2.0.6
- Fix another segfault caused by SSE2 code.
Version 1.2.0.5
- 
More portability fixes. 
- 
Force stack alignment to 16 bytes everywhere. Fixes a segfault. 
- 
Fix bug where code relied on rewrite rules firing for correctness. 
Version 1.2.0.4
- 
Update docs to match code. 
- 
Work around bug in GHCi runtime linker, which never call static initializers. 
Version 1.2.0.3
- 
Make building of SSE 4.1 code conditional, as it doesn’t work on all platforms. 
- 
Use a fixed salt, but allow random salting. Random salting by default broke people’s code. 
Version 1.2.0.2
- Work around ghci linker bug on Windows.
Version 1.2.0.1
- 
Fix performance bug in SSE implementation of SipHash. 
- 
Fix segfault due to incorrect stack alignment on Windows. 
Version 1.2.0.0
- 
Switch string hashing from FNV-1 to SipHash, in an effort to prevent collision attacks. 
- 
Switch fixed-size integer hashing to Wang hash. 
- 
The default salt now switched on every program run, in an effort to prevent collision attacks. 
- 
Move hash method out of Hashable type class. 
- 
Add support for generic instance deriving. 
- 
Add instance for Ordering. 
Version 1.1.2.5
- Bug fix for bytestring < 0.10.0.
Version 1.1.2.4
- 
Switch string hashing from Bernstein to FNV-1 
- 
Faster instance for Integer. 
- 
Update dependency on base, ghc-prim 
- 
Now works with GHC 7.6. 
Version 1.1.2.3
- 
Add instance for TypeRep. 
- 
Update dependency on test-framework. 
Version 1.1.2.2
- Bug fix for GHC 7.4
Version 1.1.2.1
- 
Update dependency on test-framework. 
- 
Improve documentation of combine. 
Version 1.1.2.0
- 
Fix hash collision issues for lists and tuples when using a user-specified salt. 
- 
Add instances for Integer,Ratio,Float,Double, andStableName.
- 
Improved instances for tuples and lists. 
Version 1.1.1.0
- 
Add hashWithSalt, which allows the user to create different hash values for the same input by providing different seeds. This is useful for application like Cuckoo hashing which need a family of hash functions.
- 
Fix a bug in the Hashableinstance forInt64/Word64on 32-bit platforms.
- 
Improved resilience to leading zero in the input being hashed. 
Version 1.1.0.0
- 
Add instance for: strict and lazy Texts, ThreadId 
- 
Add hashPtrWithSalt and hashByteArrayWithSalt. 
- 
Faster ByteArray# hashing. 
- 
Fix a signedness bug that affected ByteString. 
- 
Fix ByteString hashing to work correctly on both 32 and 64-bit platforms. 
Version 1.0.1.1
- Fix bug in Hashable instance for lazy ByteStrings where differences in the internal structure of the ByteString could cause different hash values for ByteStrings that are equal according to ==.
Version 1.0.1.0
- Add two helpers for creating Hashable instances: hashPtr and hashByteArray.
Version 1.0.0
- Separate Hashable class to its own package from hashmap 1.0.0.3.
