Created
March 12, 2015 17:38
-
-
Save tk3/b4bb329994da0845e4ca to your computer and use it in GitHub Desktop.
md5 hash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#require "digest" | |
password = 'user02' | |
key = '$apr1$' | |
salt = 'PD3O5t9N' | |
h1 = Digest::MD5.new | |
h1.update(password) | |
h1.update(key) | |
h1.update(salt) | |
h2 = Digest::MD5.new | |
h2.update(password) | |
h2.update(salt) | |
h2.update(password) | |
final = h2.digest | |
h1.update(final[0, password.length]) | |
puts h1.hexdigest | |
# ruby => 32225a00ac387c93fa00296d88999851 | |
# mruby-digest => 64ecd575be6825aea092953373318a5c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment