Skip to main content

Module constant_time

Module constant_time 

Source
Expand description

Comparisons of secrets whose running time does not depend on where the values first differ.

== on strings stops at the first mismatching byte, so how long a comparison takes tells a caller how many leading bytes they got right. Client secrets and CSRF tokens are compared here instead.

Functionsยง

optional_str_eq
Whether an optional secret matches: both absent, or both present and equal under str_eq.
str_eq
Whether a and b are the same string, in time that depends only on their lengths.