Hi guys !

I need some help with a little problem I have with MD5 hashs.

I need to be able to convert existing MD5 hexdigests to raw digests. Is
this possible?

I'll explain.

If I do : Digest::MD5.digest('password'), I get a raw MD5 digest. Right.

Then if I do : Digest::MD5.digest('password').unpack("H*")[0], then I
get the same output that if I did Digest::MD5.hexdigest('password').

But how can I do the opposite in ruby? How can I go from an existing
hexdigested MD5 string to the raw form?

I'm writing a program that needs to get hexdigested MD5 passwords
strings from a database and need to be able to use these passwords as
LDAP passwords.

In LDAP, the MD5 passwords that are created by slappasswd are raw MD5s
that are then base64 encoded.

So in ruby if I do : Base.encode64(Digest::MD5.digest('password')), I
get the exact same string as with slappasswd.

But since I already have the hexdigested passwords, it would save me and
my users the burden of changing their passwords after the migration.

Thanx!

I hope I'm clear enough.

Jonathan

-- 
Posted via http://www.ruby-forum.com/.