[Perl problems] - Computers



Search Tech-Forums - link takes you to our Forum's search page.

Note: The following is only a text archive!


To view the actual forum discussion, please visit our website at http://www.tech-forums.net

Pages:1



Perl problems

(Click here to view the original thread with full colors/images)



Posted by: jonmon6691

I am trying to write a quick script that reads MD5 sums from a file then trys matching those sums to sums of the numbers 1 - infinity until a collision is found. But the program doesn't work for some reason, it only finds the collisions on some of the sums and most of the ones that it does are wrong. Is there anything in the coding that you see wrong that I'm just missing?

[code]
#Sets up MD5
use Digest::MD5;

#File to get the sums
$hash_file = "md5_sums.txt";

#Read the lines into an array
open (INFO,$hash_file);
@hashes = <INFO>;
close INFO;

#Print what we got from the file (for debugging)
print @hashes;
print "\n";

#start a new hash object
$md5 = Digest::MD5->new;

#Main loop to go through every hash in the array
foreach $hash (@hashes)
{
#Print what hash it is reading (for debugging)
print "I'm on $hash";
#Set the index to 0
$i = 0;
#iterate through the numbers until there is a match
while ($digest != $hash)
{
#create a hash out of the number
$md5->add($i);
$digest = $md5->hexdigest;
#if the the test hash is equal to the unknown then tell us
if ($digest == $hash)
{
print "$digest is $i\n";
}
#increment i
$i++;
}
}
[/code]

all of the sums that i am trying to break are numbers.





vBulletin Copyright ©2000 - 2003, Jelsoft Enterprises Limited.


PPC Management
vB Easy Archive Final - Created by Xenon