class BCrypt::Password

def create(secret, options = {})

@password = BCrypt::Password.create("my secret", :cost => 13)

Example:

users' passwords.
attackers to try to guess passwords (even if a copy of your database is stolen), but the slower it is to check
4 is twice as much work as a :cost of 3). The higher the :cost the harder it becomes for
logarithmic variable which determines how computational expensive the hash is to calculate (a :cost of
Hashes a secret, returning a BCrypt::Password instance. Takes an optional :cost option, which is a
def create(secret, options = {})
  cost = options[:cost] || BCrypt::Engine.cost
  raise ArgumentError if cost > BCrypt::Engine::MAX_COST
  Password.new(BCrypt::Engine.hash_secret(secret, BCrypt::Engine.generate_salt(cost)))
end