NaCl- Easy-and-safe-to-use high-level Haskell bindings to NaCl
Safe HaskellNone



String comparison.

This is crypto_verify_* from NaCl.

Unlike NaCl, which provides multiple functions, this module exports only one function – eq. The function will automatically pick the correct implementation based on type-level sizes of its inputs.



eq :: forall n xBytes yBytes. (NaClComparable n, ByteArrayAccess xBytes, ByteArrayAccess yBytes) => SizedByteArray n xBytes -> SizedByteArray n yBytes -> Bool Source #

Constant-time comparison of sequences of bytes.

Unlike regular comparison, this function will always read both sequences until the end rather than exit as soon as it finds differing bytes. This makes it suitable for comparing secret data.

It only works with inputs of size 16 or 32.

class CryptoVerify n => NaClComparable n Source #

Class of bytestring lengths that can be compared in constant-time by NaCl.


Instances details
NaClComparable 16 Source # 
Instance details

Defined in NaCl.Verify

NaClComparable 32 Source # 
Instance details

Defined in NaCl.Verify