Hacking Linux Exposed

About
Authors
Contents
Reviews
Foreword
Purchase

Articles
Books
Sourcecode
Tools
Errata

Home

 


(view this code in a separate window)

#!/usr/bin/perl -w
#
# md5.pl
#
# A little program to create an MD5 digest
# based on user input.  Not the prettiest
# thing in the world.
#
# Copyright 2001, James Lee
#
# Released under GPL.  See COPYING file
# for more information.


use MD5;

print 'Plaintext password: ';
system '/bin/stty -echo';
chomp($passwd = <STDIN>);
system '/bin/stty echo';

$md5 = new MD5;
$md5->add($passwd);

print "\nMD5 digest of password is ", $md5->hexdigest(), "\n";