playframework - How to hash password in play framework (maybe with BCrypt) -


i'm bit new play framework , password hashing. tried find solutions hashing passwords , found bcrypt. think that's enough hashing passwords. , if it's good, how can working in play framework? (i'm using play 2.1.3) thanks!

here's sample play java project wrote uses bcrypt hash passwords, see newuser() , signin() actions:

https://github.com/jroper/play-demo-twitbookplus/blob/master/app/controllers/usercontroller.java

you can similar in scala. summarise, add jbycrpt dependencies in build.scala:

val appdependencies = seq(   "org.mindrot" % "jbcrypt" % "0.3m" ) 

then hash passwords using this:

string passwordhash = bcrypt.hashpw(password, bcrypt.gensalt()); 

and verify passwords using this:

bcrypt.checkpw(password, passwordhash) 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -