File Exchange

image thumbnail

MD5 signature of a file

version (2.17 KB) by Stefan Stoll
A one-file MATLAB implementation of MD5, no additional files needed.


Updated 05 Sep 2006

No License

d = md5(f)

Computes the MD5 has function of the file specified in the string f and returns it as a 64-character array in d.

md5() is a single m-file and no additional libraries or toolboxes are needed. The code is compact and clear, but very slow. So md5() is
useful for educational purposes.

Comments and Ratings (6)

yong chen

Thank You Sir


It doesn't return the same output if I hack it to take in just a string as an online implementation, but at least I can run this one on Octave. I have the feeling my hack broke something, but self-consistency of my code is more important than actually finding the MD5.

Thanks a lot for this submission.

Good job.Thanks!


Help exists, H1-line, Matlab version is checked, comments in the source, selftest function included.
Files are opened in text mode, better use FOPEN(File, 'rb'). Unfortunately the selftest function fails (Matlab 7.7) - otherwise it would be a 5 star rating.

mohamed khamis

i tried to run this file but there is some missed deffinitions..plzz send me the complete hash program cause i really need it..thanks


2006-sep-05: bug fix (thanks to Patric Schenk)

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.

Learn About Live Editor