I want to upgrade password hashing from

Digest::SHA1.hexdigest(password + some_string + salt)

to SHA512.

Is there a way to migrate existing SHA1 password hashes to the same 
security level as SHA512? What about this:

hashed_pw_sha512 = Digest::SHA512.hexdigest(hashed_pw_sha1 + other_salt)


And then authorize existing users as follows:

Digest::SHA512.hexdigest(Digest::SHA1.hexdigest(password + some_string + salt) 
+ other_salt) == hashed_pw_sha512


And as soon as users successfully login this way, then change hashing to

hashed_pw_sha512 = Digest::SHA512.hexdigest(password + other_salt)

and set the hashed_pw_sha1 attribute to nil in order to mark the user as 
migrated.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/f3a1d433-49e8-4859-ba39-12007c8d71df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to