I am using BCrypt in my RoR and I am getting numbers instead of the hexadecimal representation I am used to. Here is the criminal code.
username = params[:username]
password = params[:password]
encrypted_password = BCrypt::Password.create(password)
encrypted_password = encrypted_password.hash
the encrypted_password variable comes out as numbers like 4245597694343378249. I’ve used BCrypt for Java and I am was expecting something like $2asfa$asdfasfsafsad. I was wondering if anyone knew what I am doing wrong.
Any help is greatly appreciated.
The password variable coming out as a sequence of numbers is because of the .hash you are applying to the encrypted password. So you are calling the String#hash method which just gives you a hash based on the length and contents.
If you want to see the bcrypt output that you are expecting just do the following:
Cheers,
Sean