HORIZON HASKELLDocslts/ghc-10.0.xfc4e5982026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11

Modulelibsodium-bindings-0.0.3.0Haskell2010

LibSodium.Bindings.Comparison

Secure comparison functions, designed to run in constant time for a given input length.

  • 3 values
valuesodiumMemcmp
  1. :: Ptr CUChar

    First location with data to compare

  2. -> Ptr CUChar

    Second location with data to compare

  3. -> CSize

    How many bytes to compare

  4. -> CInt

    0 if all bytes match, -1 otherwise

#

Compares the given amount of bytes at the given locations for equality. Constant-time for any given length.

See: sodium_memcmp()

valuesodiumIsZero
  1. :: Ptr CUChar

    Location with data to check

  2. -> CSize

    How many bytes to check

  3. -> CInt

    1 if all the bytes were zeroes, 0 otherwise

#

Checks if the given number of bytes at the given location are all equal to zero. Constant-time for any given length.

See: sodium_is_zero()