MCPcopy Index your code
hub / github.com/bcrypt-ruby/bcrypt-ruby / create

Method create

lib/bcrypt/password.rb:43–47  ·  view source on GitHub ↗
(secret, options = {})

Source from the content-addressed store, hash-verified

41 #
42 # @password = BCrypt::Password.create("my secret", :cost => 13)
43 def create(secret, options = {})
44 cost = options[:cost] || BCrypt::Engine.cost
45 raise ArgumentError if cost > BCrypt::Engine::MAX_COST
46 Password.new(BCrypt::Engine.hash_secret(secret, BCrypt::Engine.generate_salt(cost)))
47 end
48
49 def valid_hash?(h)
50 /\A\$[0-9a-z]{2}\$[0-9]{2}\$[A-Za-z0-9\.\/]{53}\z/ === h

Callers 3

calibrateMethod · 0.80
engine_spec.rbFile · 0.80
password_spec.rbFile · 0.80

Calls 3

costMethod · 0.80
hash_secretMethod · 0.80
generate_saltMethod · 0.80

Tested by

no test coverage detected