In snow leopard there is program that can do md4 checksums. How can I verifiy a .md5 file?
4 Answers
In OSX, it's simply md5 or openssl md5
md5 /path/to/file
or
openssl md5 /path/to/file
Edit for clarification: You would then compare the output of the md5 command to the values in the .md5sum file to verify that the files are the same.
-
-
The contents of the MD5sum file are the md5 sum. You generate a sum on the file in question, and compare :-)– HyppyMar 17, 2011 at 15:05
-
If you dont know, this is an md5sum file genunix.org/dist/windows/liveusb/OsolLiveUSB003.md5sum and i have to validate that Mar 17, 2011 at 15:06
-
You would run "md5 OsolLiveUSB003-src.zip", and compare the output to the string of hex digits in the file, then do the same for the other filename. I edited the answer for clarification.– HyppyMar 17, 2011 at 15:10
-
no, again it is a manual comparation, i cannot compare 50000 files by hand... for example.. Mar 17, 2011 at 15:16
I see two ways for you,
- one is easier and means installing additional software,
- the other means writing a little script to automate the checksumming.
1.
install GNU md5:
get macports for your system from http://www.macports.org and install the base package. Then, install the port "md5sha1sum", which has the option "-c" to read a file containing checksums and compare files to it.
or, 2.
do it with what you have:
I assume you have a MD5 checksum file of the form:
0fd81f886638a12ed9efe4fd8b44187d dir1/dir2/file4
bc2a22d0fee688065ea19e44dae88e19 dir1/file3
fa9b969a22077e46131cdd6b602a208c dir3/file5
5c4a2bdccf48c3e7bf7489f24ac5fcb1 file1
7e06cbbb761e90e2e059657927b43f5c file2
(note that the separator are 2 spaces)
now, create new MD5 checksums locally with openssl, like:
find * -type f | xargs openssl md5 >openssl-md5
which will produce
MD5(dir1/dir2/file4)= 0fd81f886638a12ed9efe4fd8b44187d
MD5(dir1/file3)= bc2a22d0fee688065ea19e44dae88e19
MD5(dir3/file5)= fa9b969a22077e46131cdd6b602a208c
MD5(file1)= 5c4a2bdccf48c3e7bf7489f24ac5fcb1
MD5(file2)= 7e06cbbb761e90e2e059657927b43f5c
the output is different, but you can transmogrify that to match what GNU md5 makes:
cat openssl-md5 | sed -e 's/^MD5(\(.*\))= \(.*\)/\2 \1/'
0fd81f886638a12ed9efe4fd8b44187d dir1/dir2/file4
bc2a22d0fee688065ea19e44dae88e19 dir1/file3
fa9b969a22077e46131cdd6b602a208c dir3/file5
5c4a2bdccf48c3e7bf7489f24ac5fcb1 file1
7e06cbbb761e90e2e059657927b43f5c file2
this gives you a checksum file to compare to the original checksum file. Do a diff and you're finished ;-)
The solution was simply:
port install cfv
and read the manual
-
1seeing someone answering his own questions and accepting them, after getting it spelled out nicely really pisses me off. Thanks dude, remind me not to help you any more. Mar 5, 2012 at 17:08
-
2Actually his answer is the best. cfv can create md5 and can also verify them. Why do manual comparing when I have a large set of files? Thanks for the answer. Feb 20, 2014 at 2:00
-
I too was looking for the program to check an md5sum file (not just generate one). I found the answer at https://raamdev.com/2008/howto-install-md5sum-sha1sum-on-mac-os-x/
Homebrew
brew install md5sha1sum
MacPorts
sudo port install md5sha1sum
Verify
Now that you have the typical md5sum
program.
md5sum -c *.md5sum
md5
? The two are interchangeable.