module

BCrypt

Generate, read and verify BCrypt hashes.

NOTE: To use Password, you must explicitly import it with require "crypto/bcrypt/password"

require "bcrypt"

password = BCrypt::Password.create("super secret", cost: 10)
# => $2a$10$rI4xRiuAN2fyiKwynO6PPuorfuoM4L2PVv6hlnVJEmNLjqcibAfHq

password.verify("wrong secret") # => false
password.verify("super secret") # => true

See BCrypt for hints to select the cost when generating hashes.

Nested types