BuddyBoy writes
Post by BuddyBoyDoes anyone know how to include/append an MD5 string
into a text file and have the md5 of the resulting
file be correct ??
I do not think it's possible! You can't predict what the MD5 digest will
change to when you alter the file to store the digest - bit of a chicken
and egg problem.
However if you know where you have put the MD5 digest you can easily
recreate the original file and then check that against the digest.
One would think so, but one would be wrong.
First, consider the brute-force method. Include an MD5 string
in a text file and check to see if the md5 of the resulting
file is the same. If it isn't try another MD5 string. Repeat
until they match.
With 2^128 possible MD5 strings it would take 340,282,366,920,
938,463,463,374,607,431,768,211,456 tries. At a billion tries
per second, that's only 10,000,000,000,000 billion years...
PowerBASIC is fast, but not that fast. :)
So the brute force methiod won't work for us. Can we do it any
faster? It turns out that we can in the case of MD5. Look here:
[ http://en.wikipedia.org/wiki/MD5CRK ]
Hey! Only 700 years at a billion tries per second!!
Maybe if I exercise and eat right... :)
So, can we do better? Yes. Look here:
[ http://eprint.iacr.org/2005/075 ]
[ http://passcracking.com/ ]
[ http://en.wikipedia.org/wiki/Md5 ]
[ http://www.cryptography.com/cnews/hash.html ]
[ http://www.antsight.com/zsl/rainbowcrack/ ]
[ http://lasecwww.epfl.ch/php_code/publications/search.php?ref=Oech03 ]
So now we are down to less than a day instead of it taking so long
that the heat death of the universe will pull our power plug long
before we finish the calculation - thus showing the power of looking
for improved algorithms instead of optimizing our code.
It would be interesting to write a PowerBASIC program that does
what Buddyboy wants to do.
--
Guy Macon <http://www.guymacon.com/>