pbhogan / scrypt

A Ruby gem with native C extension for the scrypt password hashing algorithm.
https://github.com/pbhogan/scrypt
Other
260 stars 63 forks source link

Can't decrypt MCF formatted hashes #45

Open scottgonzalez opened 8 years ago

scottgonzalez commented 8 years ago

Note: I don't know much about SCrypt, so I may be describing this wrong.

I have password hashes that were generated by a different project that I need to use inside a new Rails project. The hashes start with "$s0$" which seems to mean that they use version 0 of the format with 128-bit salt and 256-bit derived key. When I pass these hashes to SCrypt::Password.new, I get an invalid hash error. Is there some other method I should be using or is this format not supported?

Here's an example hash that was generated from the string "password": $s0$e0801$1bEUOnAzdsDd2fWCL1yKN4UCHHzV70fi5EHc6Fmk610=$Yp4N+9UaJ3hG7KoOk+1yUf9+rieAASVzuEifeqW7z44=

scottgonzalez commented 8 years ago

This is apparently the MCF format.

stakach commented 8 years ago

At this point the format is not supported.

I'd be open to accepting a pull request for support of these strings. A helper method like SCrypt::Password.mcf(user.password)