(secret, options = {})
| 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 |
no test coverage detected