Home page logo
/

basics logo Security Basics mailing list archives

Re: Re[2]: MD5 algorithm
From: Matt Howard <securityfocus () hattmoward org>
Date: Wed, 24 Mar 2004 10:01:07 -0500

On Tuesday 23 March 2004 12:59 pm, you wrote:
Hello Matt,

Quite so. I speak english not well, that's why i used 'realization'
instead of 'implementation'
That's okay, as long as what you're saying is understood.

MH> You can find Digest::MD5 on CPAN
MH> (http://www.cpan.org) Are you familiar with it?  As root, on your PC,
run: MH> perl -MCPAN -e shell
MH> It will ask some questions and select a mirror, then you can type
MH> install Digest::MD5
MH> to get what you're looking for.  After it's installed, you can run
MH> man Digest::MD5
MH> or
MH> perldoc Digest::MD5
But I received only 16,22 or 32-byte hashes. Why not 34-byte hashes?
And how can I use Digest::MD5 for it? Or maybe you can show me a
script on perl or c/c++ with its implementation.
This is the RFC for MD5 along with a C reference implementation:
http://www.fourmilab.ch/md5/rfc1321.html

There is a perl example at the top of the documentation for Digest::MD5.

MD5 is supposed to produce 128-bit (16-byte) hashes.  I'm not really sure why 
you would be expecting 34 bytes, but there /is/ one thing that people will 
get bitten on with Digest::MD5.  The md5 function produces the hash itself, 
that is, it returns a 128-bit value that is the MD5 hash (a real packed 
binary value, not a perl "number").  md5_hex and md5_b64 both call the md5 
function and return the character representation of that 128-bit value in the 
requested base.  md5_hex produces the expected output if you're checking 
against the md5sum tool, or checking md5 hashes posted on a web page.  The 
length of md5_hex data should be 32 bytes, and the length of md5_b64 data 
should be 22.  If you want to see the binary expansion of the md5 function, 
do this:

print unpack("B*", md5($data));


MH> to see the documentation and usage examples.  If you have any Perl
related MH> questions, you can ask them at Perl Monks
(http://www.perlmonks.org). Thanks for link.

-- 
Matt Howard <mhoward__hattmoward.org>  http://hattmoward.org
PGP: 2364 B8D1 199C 4DB6 9E23  2409 C10B EC85 29B9 91EE


---------------------------------------------------------------------------
Ethical Hacking at the InfoSec Institute. Mention this ad and get $545 off 
any course! All of our class sizes are guaranteed to be 10 students or less 
to facilitate one-on-one interaction with one of our expert instructors. 
Attend a course taught by an expert instructor with years of in-the-field 
pen testing experience in our state of the art hacking lab. Master the skills 
of an Ethical Hacker to better assess the security of your organization. 
Visit us at: 
http://www.infosecinstitute.com/courses/ethical_hacking_training.html
----------------------------------------------------------------------------


  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]
AlienVault