How to verify a .md5sum file in snow leopard?

6

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

tapioco123

Posted 2011-03-17T14:37:36.697

Reputation: 193

is there md5? The two are interchangeable. – Majenko – 2011-03-17T14:46:55.347

EXAMPLE: http://genunix.org/dist/windows/liveusb/OsolLiveUSB003.md5sum and i have to validate that

– tapioco123 – 2011-03-17T15:06:58.953

Answers

2

The solution was simply:

port install cfv

and read the manual

tapioco123

Posted 2011-03-17T14:37:36.697

Reputation: 193

would do the same seeing other people providing irrelevant answers – meso_2600 – 2019-01-05T06:57:10.983

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. – Florenz Kley – 2012-03-05T17:08:47.053

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. – therealmarv – 2014-02-20T02:00:49.990

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

Posted 2011-03-17T14:37:36.697

Reputation: 3 636

no, i ask how to check a .md5sum file, not how to generate it! – tapioco123 – 2011-03-17T15:02:42.217

The contents of the MD5sum file are the md5 sum. You generate a sum on the file in question, and compare :-) – Hyppy – 2011-03-17T15:05:25.537

If you dont know, this is an md5sum file http://genunix.org/dist/windows/liveusb/OsolLiveUSB003.md5sum and i have to validate that

– tapioco123 – 2011-03-17T15:06:41.107

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 – 2011-03-17T15:10:45.173

no, again it is a manual comparation, i cannot compare 50000 files by hand... for example.. – tapioco123 – 2011-03-17T15:16:13.840

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 – 2011-03-17T15:20:21.447

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

Posted 2011-03-17T14:37:36.697

Reputation: 1 453

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

Posted 2011-03-17T14:37:36.697

Reputation: 111