6

In snow leopard there is program that can do md4 checksums. How can I verifiy a .md5 file?

soandos
  • 24,206
  • 28
  • 102
  • 134
tapioco123
  • 193
  • 1
  • 6

4 Answers4

5

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.

Hyppy
  • 3,712
  • 20
  • 18
  • no, i ask how to check a .md5sum file, not how to generate it! – tapioco123 Mar 17 '11 at 15:02
  • The contents of the MD5sum file are the md5 sum. You generate a sum on the file in question, and compare :-) – Hyppy Mar 17 '11 at 15:05
  • If you dont know, this is an md5sum file http://genunix.org/dist/windows/liveusb/OsolLiveUSB003.md5sum and i have to validate that – tapioco123 Mar 17 '11 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. – Hyppy Mar 17 '11 at 15:10
  • no, again it is a manual comparation, i cannot compare 50000 files by hand... for example.. – tapioco123 Mar 17 '11 at 15:16
  • It would have to be scripted. You could use the instructions here: http://solidstateraam.com/mac-os-x-replicating-md5sum-output-format/ to create a Linux/Unix-like md5sum output, and then use something to programmatically compare the files. I do not believe it is available as a native function in OSX at all, especially when you're trying to use a non-OSX formatted md5sum file. – Hyppy Mar 17 '11 at 15:20
5

I see two ways for you,

  1. one is easier and means installing additional software,
  2. 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 ;-)

Florenz Kley
  • 1,531
  • 7
  • 18
2

The solution was simply:

port install cfv

and read the manual

Simon Sheehan
  • 9,114
  • 12
  • 52
  • 71
tapioco123
  • 193
  • 1
  • 6
  • 1
    seeing 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. – Florenz Kley Mar 05 '12 at 17:08
  • 2
    Actually 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. – therealmarv Feb 20 '14 at 02:00
  • would do the same seeing other people providing irrelevant answers – meso_2600 Jan 05 '19 at 06:57
1

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

Jon Wolski
  • 111
  • 3