Last active
February 8, 2016 04:34
-
-
Save kkismd/65b3ae1c70f2a8dc51af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> import org.mindrot.jbcrypt.BCrypt | |
import org.mindrot.jbcrypt.BCrypt | |
scala> val pw = "my password" | |
pw: String = my password | |
scala> val salt = BCrypt.gensalt() | |
salt: String = $2a$10$AsMc1b5AYVudBaXWXTYpe. | |
scala> val encryptedPassword = BCrypt.hashpw(pw, salt) | |
encryptedPassword: String = $2a$10$AsMc1b5AYVudBaXWXTYpe.4EHEYreFsLG3tYNwfFoWaQl5givVYqm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):001:0> require 'bcrypt' | |
=> true | |
irb(main):005:0> bcrypt = BCrypt::Password.new("$2a$10$AsMc1b5AYVudBaXWXTYpe.4EHEYreFsLG3tYNwfFoWaQl5givVYqm") | |
=> "$2a$10$AsMc1b5AYVudBaXWXTYpe.4EHEYreFsLG3tYNwfFoWaQl5givVYqm" | |
irb(main):006:0> salt = bcrypt.salt | |
=> "$2a$10$AsMc1b5AYVudBaXWXTYpe." | |
irb(main):007:0> enctypted = BCrypt::Engine.hash_secret("my password", salt) | |
=> "$2a$10$AsMc1b5AYVudBaXWXTYpe.4EHEYreFsLG3tYNwfFoWaQl5givVYqm" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment