Md5 hash generation

You are brilliant :smiley: :smile: :rofl:

Hi,
I downloaded the code, but I never compiled an app which includes C code, so I tried to compile the application with Clarion 6.3 and got these errors:
Unresolved External _MD5Init in md5te002.obj
Unresolved External _MD5Update in md5te002.obj
Unresolved External _MD5Final in md5te002.obj

what am I suppose to do to solve this ?

Regards

working_6.3.zip (8.3 KB)

sk2107, does this work for you?

I will check.

Thank you

The exe was created and running fine thank you. but my main problem is getting the md5 of large files (more than 5 GB and could reach 20 GB in some cases). I donโ€™t know if this code can help in this case.

Regards

Ah, yes, that would be a problem. I donโ€™t think this code will help with that, sorry.

Thank you. but still it is a good example for me.

Regards

IF you need it to match something generated elsewhere, then make sure that the values match! I added MD5 using a DLL I found online after trying several other methods as none of them produced MD5 hash that was compatible with what PHP generated.

@sk2107; included is the md5 code with a small program; I think that it will compile in cw6; you can use it with large files, but check it first with some know results.
I have NOT tested it.

I tested it but still it is not giving the correct result for large files (more than 4GB) and I think the reason is that the DOS driver used has the limit of 4,294,967,295B for file or record. (Hope I am wrong).

Any how thank you for your contribution.

Regards

That limit of DOS driver Is not relevant. All that matter is if the file is bigger than the buffer. I checked the program with one file of 1.5MB and the result is correct.
Again, do your own test.
i uploaded a revised version.

no you are not wrong. You would need to use Win API for reading large files and use Big Ints (64 bit) for the offsets within the file.

I wrote a bigFile class maybe 7 or 8 years back that did that kind of thing. Maybe I can look at that code and create something that can do MD5 for large files > 4GB. Might take a few days as I am away on holidays at the moment.

Thank you

Best regards

sorry, you were right. You can not process files bigger than 4GB, you need to use CreateFileA (windows API).