Skip to content

Conversation

@jonathanreveille
Copy link
Member

@jonathanreveille jonathanreveille commented Jan 7, 2026

Purpose

The python documentation recommends to compare a and b values of same type with hmac.compare_digest. This method returns a constant-time when comparing the two values, not allowing a time attacker to understand the length or types of a and b. This approach is designed to prevent timing analysis.

Proposal

  • Use hmac.compare_digest() to prevent timing analysis

The python documentation recommends to compare a and b
values of same type with `hmac.compare_digest`. This method
returns a constant-time when comparing the two values, not
allowing a time attacker to understand the length or types of
a and b. This approach is designed to prevent timing analysis.
@jonathanreveille jonathanreveille merged commit a1b5bbd into master Jan 12, 2026
19 of 20 checks passed
@jonathanreveille jonathanreveille deleted the security/prevent_timing_analysis branch January 12, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants