Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

class method

OpenSSL.fixed_length_secure_compare

(::String, ::String) -> bool
OpenSSL.fixed_length_secure_compare(string, string) → boolean

Constant time memory comparison for fixed length strings, such as results of HMAC calculations.

Returns true if the strings are identical, false if they are of the same length but not identical. If the length is different, ArgumentError is raised.

See also .fips_mode= .secure_compare .fips_mode #Digest also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0