MD5 is a 128 bit message digest developped by the RSA Data Security Inc. and described in the RFC 1321.
This implementation calculates the MD5 sum for files, strings or byte streams (e.g. UINT8 arrays). The sum can be replied as [1 x 16] double vector, [1 x 32] hexadecimal number or as [1 x 22] base64 number.
For strings either ASCII or Unicode values are considered.
There are some MD5 implementations on the FEX already:
1. Michael Kleder's excellent java method for MD2, MD5, SHA-1/256/384/512 hashes:
The C-Mex CalcMD5 published here is faster: 90% faster for 10kB strings, 30% for 1MB strings, 40% for 10MB strings (see screen shot). In addition CalcMD5 can process files directly without the need of importing them to the memory.
2. Steven Huang's MD5 C-Mex:
This file has some bugs. After fixing them, the speed is similar, because it is based on the same public C-source from the RFC 1321. CalcMD5 handles Unicode strings and byte streams in addition. Huang's MD5 let FOPEN decide, if the input is a file name or a string.
3. Suresh Joel's tool calls an EXE file based on the same C-source:
It works for files only and not for arrays or strings directly. Calling EXE files can be restricted by virus protectors.
4. Some further MD5 tools on the FEX do not reply correct answers.
Summary: CalcMD5 does not add something really new to the FEX. The small advantages are just the speed, the possibility to access files and arrays with the same tool and the different output formats.
Pre-compiled DLLs (Matlab 6) and MEXW32 (Matlab >= 7.6) can be found at:
Now the MEX compiles for 64-bit addressing also, but currently arrays and files are limited to 2.1GB. Full 64 bit support is under construction.