Safe Haskell | None |
---|---|
Language | Haskell2010 |
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.
Synopsis
- eq :: forall n xBytes yBytes. (NaClComparable n, ByteArrayAccess xBytes, ByteArrayAccess yBytes) => SizedByteArray n xBytes -> SizedByteArray n yBytes -> Bool
- class CryptoVerify n => NaClComparable n
Documentation
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
NaClComparable 16 Source # | |
Defined in NaCl.Verify | |
NaClComparable 32 Source # | |
Defined in NaCl.Verify |