I found that an MD5 has does not change at all even if the input changes. In
the following example code.. The results are shown after the __END_.

Is my expectation wrong?

#$data = "abcffdgfdgfdg vdefdfjdfjds lkfjdfjsd";
$data = "abcffdgfdgfdg vdefdfjdDSDSDSADAS  fjds lkfjdfjsd";
print "Data was $data \n";
 use Digest::MD5;
 $ctx = Digest::MD5->new;
 $ctx->add($data);
 $digest = $ctx->digest;
 print "digest is = $digest\n";
 $digest = $ctx->hexdigest;
 print "hex digest is = $digest\n";
 $digest = $ctx->b64digest;
 print "base 64 digest is = $digest\n";

__END__
---------- perl test 1----------
Data was abcffdgfdgfdg vdefdfjdfjds lkfjdfjsd
digest is = o?AO?Co6}UoP@
hex digest is = d41d8cd98f00b204e9800998ecf8427e
base 64 digest is = 1B2M2Y8AsgTpgAmY7PhCfg
Normal Termination
Output completed (0 sec consumed).

---------- perl test 2----------
Data was abcffdgfdgfdg vdefdfjdDSDSDSADAS  fjds lkfjdfjsd
digest is = A?</?e_rYoC!,,j8
hex digest is = d41d8cd98f00b204e9800998ecf8427e
base 64 digest is = 1B2M2Y8AsgTpgAmY7PhCfg
Normal Termination
Output completed (0 sec consumed).

====================================
Ranga Nathan
Reliance Technology
Legacy to Web integration consultancy
Text to web-database-spreadsheet, datamarts
ADABAS, NATURAL, Perl, Apache, Linux, Wintel solutions
Tel: 617 884 9801 Fax: 781 623 5646
http://www.cobolexplorer.com - cobol listings on the web
http://www.any2xml.com - text to anything
http://www.goreliance.com
http://www.adaexplorer.com - ADAREP on the web + stats


Reply via email to