On Fri, 18 Jan 2008, Pierangelo Masarati wrote:
Looks like a hexpair representation of a binary value. Convert it to binary and base64 encode it.
Indeed. For the archives, here's the script I used:
#-------------------------------------------# #!/usr/bin/perl use MIME::Base64; use strict; my @md5 = split "",$ARGV[0]; my @res; for (my $i = 0 ; $i < 32 ; $i+=2) { my $c = (((hex $md5[$i]) << 4) % 255) | (hex $md5[$i+1]); $res[$i/2] = chr $c; } print "{MD5}".encode_base64(join "", @res); #-------------------------------------------#
$ perl md5_sql2ldap.pl 5f4dcc3b5aa765d61d8327deb882cf99 {MD5}X03MO1qnZdYdgyfeuILPmQ==
Thanks.