20060702 8:35 by javier
This snippet is a simple wrapper around Digest::MD5’s md5_base64() builds unsalted MD5 digests encoded in base64, very useful for LDAP management and LDIF file processing.
#!/usr/bin/perl
++$|;
use Digest::MD5 qw(md5_base64);
if(!defined($pass=shift)) {
print “> “;
$pass=<STDIN>;
chomp $pass;
}
print encrypted($pass).“\n“;
sub encrypted {
my($passwd) = @_;
return ‘{md5}’.md5_base64($passwd).‘==’;
}
(Source code)
Use it as such:
$ bin/md5pass
> password
{md5}X03MO1qnZdYdgyfeuILPmQ==
This entry was posted
on Sunday, July 2nd, 2006 at 8:35 and is filed under Code, General, Perl.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.