Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

class method

OpenSSL.fixed_length_secure_compare

(::String, ::String) -> bool
OpenSSL.fixed_length_secure_compare(string, string) → true or false

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.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0