chrislewis60/simplesamlphp-sqlauthbcrypt — pull request #1 by chrislewis60 (2013-04-25 16:38:36+00:00)
Title: No separate salt

Hi hvirring, firstly thanks for setting up this BCrypt module - saved me loads of time! However, I did have to tweak it to get it to work with my setup so I'll just run through the justification and if you agree then feel free to pull the changes in. And just in case it makes a difference, I usually code in ruby/Rails and I'm trying to link up simplesamlphp with a database created by the Rails Devise plugin which uses BCrypt under the hood.

I eventually solved my issue by looking at this stack overflow question:
http://stackoverflow.com/questions/9321075/ruby-bcrypt-password-retrieval-in-php

It all centers around the fact that you has a separate password salt column defined. However, my understanding of BCrypt is that it enforces password salting by storing the salt as part of the password hash - therefore no separate salt column is required. So I've removed the references to the salt and when someone logs in and it compares the encrypted database password with the input password (run through crypt) I've passed the password hash to the crypt function. I believe crypt is able to extract the relevant salt from inside the hash for use in encrypting the inputted password.

I also updated the documentation to be in line with my comments above. Feel free to comment.

Regards,

Chris.