No BSD License  

Highlights from
MD5 in MATLAB

4.57143

4.6 | 7 ratings Rate this file 44 Downloads (last 30 days) File Size: 13.11 KB File ID: #7919

MD5 in MATLAB

by Steven Huang

 

26 Jun 2005 (Updated 14 Jul 2005)

An MD5 C-mex function for MATLAB. It takes less than 1 minute for a 700MB file size.

| Watch this File

File Information
Description

This MATLAB version MD5 is for checksum of files and strings. The speed is very fast. A timer shows time taken to finish the process in seconds.

Just type: mMD5('filename') for a file or mMD5('string') for a string, eg., mMD5('abcd').

Reference: Tian-tai Huynh, MD5 in C

Acknowledgements
This submission has inspired the following:
CalcMD5
MATLAB release MATLAB 6.5 (R13)
Other requirements Visual C++ 6
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (10)
12 Jul 2005 Ulrik Kjems

I would like to get the MD5 sum returned as a matlab string argument.
Also I would like to be able to call the function incrementially so that the md5sum could be computed over many variables.

10 Jan 2006 Frank ???

Great tool! Thanks.
Frank

12 Aug 2007 Dmitry Antonov

It really works very fast! Thanks a lot.

17 Jan 2008 Tobias Schweickhardt

Superb tool!
For those not familiar with c-mex functions: type "mex mMD5" to compile before use. Also works with LCC (MSVC not necessary).

30 May 2008 Dinesh Zende

This function is really great... It had saved my lot of work

21 Jul 2008 Anthony Kendall

Great! It compiles with no problems (WinXP, R2008a, Visual C++), and runs very quickly.

It's just as fast as external MD5 programs, for instance MD5deep.exe on WinXP, and produces identical results.

09 Oct 2008 Devang gandhi

I am getting core dump after I run an excel file through the algorithm. Any suggestions as to why that is the case?

05 May 2009 Ryan Ollos

I've compiled this in r2009a under Vista 32bit using lcc.

I'm getting a segfault nearly everytime I call this:

The process takes 0 seconds
MEMORY BLOCK INTEGRITY FAILURE: ptr = 0x1F39FD40 caller = free(ptr)
Data has been written off the end of a memory block.
This block of memory has already been freed.
The size of the array was 32 bytes.
The value of the free counter is count = 288020,
alloc counter in header of memory block = 384563.

05 May 2009 Ryan Ollos

There are several problems with this function:

1. printf statements are used rather than mexPrintf.
2. The output char array needs to be 1 greater in length.
3. Memory allocated to the output char array is deallocated before the function exits.

If anyone would like a working version, feel free to message me.

30 Jun 2011 Edgar VĂ©lez Marquez  
Please login to add a comment or rating.
Updates
14 Jul 2005

The file has been updated to save the MD5 sum in a variable. For example:

% for a file
a = mMD5('filename')

% for a string
a = mMD5('string')

14 Jul 2005

That is a good point to have the MD5 sum output stored in a string. The file has been updated. To use this function, just do:
% for a file:
a = mMD5('contents.m')
or
% for a string:
a = mMD5('abcd')
the MD5 sum now is saved in variable a.

14 Jul 2005

That is a good point to have the MD5 sum output stored in a string. The file has been updated. To use this function, just do:
% for a file:
a = mMD5('contents.m')
or
% for a string:
a = mMD5('abcd')
the MD5 sum now is saved in variable a.

Tag Activity for this File
Tag Applied By Date/Time
path Steven Huang 22 Oct 2008 07:51:19
directories Steven Huang 22 Oct 2008 07:51:19
files Steven Huang 22 Oct 2008 07:51:19
md5 Steven Huang 22 Oct 2008 07:51:19
utilities Steven Huang 22 Oct 2008 07:51:19
cmex function Steven Huang 22 Oct 2008 07:51:19
cmex function Dmitriy 07 Dec 2011 17:14:22
md5 Dmitriy 07 Dec 2011 17:15:38

Contact us at files@mathworks.com