duck.utils.safe_compareΒΆ
Module for safer comparison of sensitive information without having to worry about timing attacks
Module ContentsΒΆ
FunctionsΒΆ
This is a constant time comparison function with a sense of avoiding timing attacks, meaning, nomatter how short or long the 2 strings are, the time of comparing any kind of string is the same (constant), hence tackling timing attacks. |
APIΒΆ
- duck.utils.safe_compare.constant_time_compare(str_a: str, str_b: str)[source]ΒΆ
This is a constant time comparison function with a sense of avoiding timing attacks, meaning, nomatter how short or long the 2 strings are, the time of comparing any kind of string is the same (constant), hence tackling timing attacks.