I'm talking about this:
$ openssl passwd -1 -salt thesalt thepassword
$1$thesalt$HAWpBmvUCutuyTS4JwevI.
In PHP it would look like this:
crypt('thepassword', ('$1$'.'thesalt')); # this gives the same output as above
I'm trying to achieve the same format in Ruby 1.9. I've been told Ruby's String#crypt will do this but it does not. I've looked everywhere for an answer, but I've come across nothing.
If it helps anything, I'm trying to do this on Windows XP. Ruby version: ruby 1.9.3p0 (2011-10-30) [i386-mingw32]
Just to keep away the comments telling me to use something other than MD5 or whatever else, I would if I could. This choice isn't up to me.
Thanks.
Edit: I want to do this without shelling out to openssl because that would be too slow for what I need.