Scala port of a Java BCrypt library.
- Have a version of BCrypt in Scala
- Learn how it works
- Implement Version 2b
- Better testing
import ft.crypt.bcrypt.BCrypt
val plain = "YourPlainPassword"
// Generate the salt. Can take log rounds (between 2 and 30, where 30 will be the hardest and will take a long time)
val salt = BCrypt.generateSalt
val hashed = BCrypt.hashPassword(plain, salt)
val passwordsMatch = BCrypt.checkPassword(plain, hashed)
if (passwordsMatch) {
println("Congrats! You can go in")
} else {
println("Call the police!")
}