hash-string-0.1.0.0: binary strings supporting constant-time base16 and comparisons
Copyright(c) 2024 Auth Global
LicenseApache2
Safe HaskellSafe-Inferred
LanguageHaskell2010

Crypto.HashString

Description

binary string types supporting constant-time base16 encoding and decoding, as well as constant time lexicographic comparisons. Note that the time required does depend linearly on length, but is otherwise data-independent.

Synopsis

Documentation

data HashString Source #

Type intended to represent short-ish cryptographic values, say up to 128 bytes or so. Supports constant-time comparisons (i.e. run time depends on length of the inputs but is otherwise independent of content), as well as constant-time base16 and base64 conversions.

xorLeft :: HashString -> HashString -> HashString Source #

Xor two hashstrings. The length of the result is always the same as the length of the left argument; bytes are either removed from or added to the end of the right argument as needed to match length.

xorMin :: HashString -> HashString -> HashString Source #

Xor two hashstrings. The length of the result is always the same as the length of the shorter argument, removing bytes from the end of the longer string as needed to match length.

xorMax :: HashString -> HashString -> HashString Source #

Xor two hashstrings. The length of the result is always the same as the length of the longer argument, adding null bytes onto the end of the shorter string as needed to match length.