ive been working on some code and it doesnt seem to be working right.
here is the code...
#!/usr/bin/perl -w use strict; use Digest::Perl::MD5 'md5_hex'; my $list = "mil-dic.txt" ; #wordlist my $cmd = 'jonsmith'; # hash to crack getmd5(); sub getmd5 { open (F, $list) || die ("\nCan not open file !"); my @md5 = <F>; close(F); print "\nBruteforcing... please wait.\n\n"; foreach my $md5 (@md5) { chomp $md5; #print $md5."\n"; AddTo($md5); } } sub AddTo { my $check = shift; my $match_1 = md5_hex $check ; my $match_2 = md5_hex $cmd; if ($check =~ $cmd) { print $match_1."\n"; print $check."\n\n"; print $match_2."\n"; print $cmd."\n\n"; } exit(0); if ($match_1 =~ $match_2) { print "\nFound !\t[$check]\n\n"; open (A, ">>found.txt") || die ("\nCan not open file to write to !\ +n"); print A "[$match_2] : [$check]\n"; close(A); } }
the output is...
Bruteforcing... please wait. b2ce97ce53eddef748a19dd6d09c9033 jonsmith 146ecb91572c5330c7d750ed29811a38 jonsmith
as you can see the two dont match.
anyone care to enlighten me?

2006-10-10 Retitled by Arunbear, as per Monastery guidelines
Original title: 'md5_hex'


In reply to md5_hex gives different values for same string by jonsmith1982

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.