secretutils

oslo_utils.secretutils.constant_time_compare(first, second)

Returns True if both string inputs are equal, otherwise False.

This function should take a constant amount of time regardless of how many characters in the strings match. This function uses an approach designed to prevent timing analysis by avoiding content-based short circuiting behaviour, making it appropriate for cryptography.