Cryptographic utilities


This vocabulary provides common utility functions for cryptographic implementations.

These utilities are designed to avoid side-channel vulnerabilities that can leak secret information through timing, cache behavior, or other observable effects.

Constant-time operations
constant-time= ( a b -- ? )

constant-time-zero? ( seq -- ? )

constant-time-select ( flag a b -- a/b )


Security notes
Timing attacks exploit the fact that many operations take different amounts of time depending on the data being processed. For example, a naive byte-by-byte comparison returns early on the first mismatch, allowing an attacker to determine how many bytes of a secret value they have guessed correctly.

The functions in this vocabulary are designed to take the same amount of time regardless of the input values, preventing such attacks.