I seem to be unable to create a working MD5 test. The MD5 functions in the snippet of code below keep returning the same garbage string no matter what input you feed them and I'm not really sure how to handle it short of rewriting it as an external program. (Also, should I be using SHA1 instead?)
{ takes a filename fn and a user-input MD5 hash phash as input, compares with an MD5 hash generated from fn. Not working on OS X Yosemite. }
function testMd5(fn, phash: string): boolean;
var lhash: string;
begin
lhash := MD5Print(MD5File(fn));
writeln(lhash);
if lhash = phash
then testMd5 := true
else testMd5 := false;
end;