Skip to content

End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

class method

OpenSSL.secure_compare

OpenSSL.secure_compare(string, string) → boolean

Constant time memory comparison. Inputs are hashed using SHA-256 to mask the length of the secret. Returns true if the strings are identical, false otherwise.

See also .print_mem_leaks #Digest .mem_check_start also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0