class BCrypt::Password
def ==(secret)
@password.to_s == @password # => True
@password == @password.to_s # => False
@password == @password # => False
@password == secret # => True
@password = BCrypt::Password.create(secret)
secret = "my secret"
Comparison edge case/gotcha:
Compares a potential secret against the hash. Returns true if the secret is the original secret, false otherwise.
def ==(secret) super(BCrypt::Engine.hash_secret(secret, @salt)) end