HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulelibsodium-bindings-0.0.1.1Haskell2010

LibSodium.Bindings.Comparison

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

  • 2 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()