Search code examples
ruby-on-railsencryptiondevisepasswords

Decrypting a devise password


I need to decrypt a password generated by devise.

For example, my password is test123test. devise generated this password:

$2a$10$vGeVVu.E0XGjlNEa0xMCK.R0SEH0aFuyJpefrq01Axz6WSbHApPEu 

I need to decrypt the password and send test123test.


Solution

  • You can't, that's the whole point.

    Bcrypt will allow you compare test123test with $2a$10$vGeVVu.E0XGjlNEa0xMCK.R0SEH0aFuyJpefrq01Axz6WSbHApPEu, but it will never give you the plain text password back. You might want to ask how to crack a bcrypt encrypted password instead (Very hard! Nearly impossible I think)

    Jose Valim describes the motivation behind choosing bcrypt by linking to http://codahale.com/how-to-safely-store-a-password/ from the devise Google Group.