Efficient XOR masking

Version on this page:
LTS Haskell 22.23:
Stackage Nightly 2024-05-30:
Latest on Hackage:

See all snapshots xor appears in

GPL-2.0-or-later licensed by Herbert Valerio Riedel
Maintained by Andreas Abel
This version can be pinned in stack with:xor-,2968

Module documentation for

Used by 1 package in lts-21.23(full list with versions):

This package provides efficient implementations of routines for applying bitwise XOR masks to binary data.

The currently supported operations (see Data.XOR API documentation for more details) are applying

  • 8-bit wide XOR masks or

  • 32-bit wide XOR masks

to binary data represented by

  • Strict ByteStrings,

  • Lazy ByteStrings,

  • ShortByteStrings (i.e. ByteArray#s), or

  • CStringLen (i.e. Ptrs).

The performance is comparable to portable ISO C99 implementations but this library is implemented as pure Haskell and is thereby compatible with compile targets such as GHCJS.


Andreas Abel, 2023-07-19

  • Use copyBytes for deprecated memcpy as suggested by bytestring-0.11.5.
  • Tested with GHC 7.4 - 9.6.

Andreas Abel, 2022-02-16

  • Allow GHC 9.0 and 9.2.
  • Allow bytestring-0.11 for GHC ≥ 8.
  • Tested with GHC 7.4 - 9.2.


Herbert Valerio Riedel, 2020-05-17

Initial release.