Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > How to use checksum and md5 when archiving

How to use checksum and md5 when archiving
Thread Tools
Fresh-Faced Recruit
Join Date: Jun 2002
Location: Hampshire, England
Status: Offline
Reply With Quote
Apr 19, 2004, 02:21 AM
 
Hi,

I have no idea how to use md5 or checksum but I have been told I can use these to help me when archiving work.

What I want to do is archive work onto DVD and I would like to produce a checksum of the DVD's content in order that I can quickly verify that the contents are intact (for example when I copy work back from DVD or make a copy of that DVD).

Is it possible to checksum the content of a directory then write it to DVD and save the checksum on the DVD too?

I would appreciate real examples of how to use the cksum/md5 commands as there are no examples given in the man pages.

Many thanks in advance,

John B
     
Senior User
Join Date: Jan 2003
Location: Stuttgart, Germany
Status: Offline
Reply With Quote
Apr 19, 2004, 04:45 AM
 
Just use md5sum for this purpose:
Code:
find <dir> -type f -print0 | xargs -0 md5sum > digest
This will generate checksums of all files in <dir> and write them to a file called "digest" in the current directory. If you now want to check the integrity of those files, you run
Code:
md5sum -c digest
which will then compare the md5s of the files with the ones stored in "digest". You can also wrap all this in a script if you can't remember the exact arguments (at least I can't). Something like this should do:
Code:
#!/bin/sh find $1 -type f -print0 | xargs -0 md5sum > digest
     
Mac Elite
Join Date: Apr 2000
Location: Los Angeles, CA
Status: Offline
Reply With Quote
Apr 19, 2004, 09:11 AM
 
The purpose of a checksum is to provide programs/users information on the "signature" of a particular file. When copying a file, you basically compare the checksum of the original file (created when the file was first made) with the checksum of the copied file. If the checksums match, then the file was copied exactly. If not, then the new file may have something added or modified, and is not an exact duplicate of the first.

Checksums are popularly used by several Linux distribution sites, to ensure that the CD image you downloaded is an exact duplicate of what was initially made available.

In your setup, you can opt to do one of two things:
- make a checksum of each of the files for archiving
- make a checksum of the disc for archiving

The former is particularly useful when you have individual files that you want to be sure are perfectly intact. The latter is useful if only for distribution of the disc (to make sure that the disc one user has is the same as the original one).

I found some apps in VersionTracker that computes the MD5 hash of a file, but I'm not sure if any of them can do batch jobs. In any case, the applications are: md5app, MD5shot, CheckMate, and checksum+.
     
Fresh-Faced Recruit
Join Date: Jun 2002
Location: Hampshire, England
Status: Offline
Reply With Quote
Apr 19, 2004, 09:41 AM
 
Thanks for both of those extremely useful replies.

John
     
Fresh-Faced Recruit
Join Date: Jun 2002
Location: Hampshire, England
Status: Offline
Reply With Quote
Apr 19, 2004, 01:57 PM
 
Unfortunately I don't have "md5sum" in my version of OS X...
     
Senior User
Join Date: Jan 2003
Location: Stuttgart, Germany
Status: Offline
Reply With Quote
Apr 20, 2004, 05:09 AM
 
Originally posted by smokingdrum:
Unfortunately I don't have "md5sum" in my version of OS X...
Oops. Turns out it isn't installed by default on OS X. It is actually part of Fink.
     
Mac Elite
Join Date: Apr 2000
Location: Los Angeles, CA
Status: Offline
Reply With Quote
Apr 20, 2004, 07:44 AM
 
md5sum is part of fink. You can download a copy from my site (if that's all you want).
     
Dedicated MacNNer
Join Date: Sep 2001
Location: San Jose CA
Status: Offline
Reply With Quote
Apr 20, 2004, 11:51 AM
 
Originally posted by smokingdrum:
Unfortunately I don't have "md5sum" in my version of OS X...
On 10.3.x you can get generate an md5 sum for a file in one of two ways:

md5 [file]

or

openssl md5 [file]

Openssl gives you access to several other hashing functions (SHA1, RIPE-160, &c.) in addition to md5.

I'm not sure if this is an issue for you, but not all OSes have a builtin md5 (or md5sum) command, so you may want to also generate a CRC checksum using the cksum command.

--ranga
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:29 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2