Humppa Validation

While testing out the ami.c patch for dlg@, I once again needed validate
files are being written correctly. Keeping with the OpenBSD theme, I
used the MP3 files created from my Elakelaiset "Werbung Baby" CD for
testing out the 480GB RAID5 volume.

Once you've got your humppa on a BSD box cksum(1) and friends can take
care of creating message digests (cksum, sum, sysvsum, md4, md5, rmd160,
sha1, sha256, sha384. sha512), storing them into a text file and then
validating the original files were written correctly.

$ md5 *.mp3 >bsdmd5.md5

You end up with a file in the standard format we all know and love:

MD5 (01-Hump.mp3) = 1ecc9c0165043bda9ac07ae35a627cc4
MD5 (02-Humppakonehumppa.mp3) = 0c1cb2e6347b541830125dfcc41a6f00
MD5 (03-Humppamedia.mp3) = d0ee034280d835894e859258a5df4d8f
MD5 (04-Punakka_Humppa.mp3) = b768d3491261f1b256ba2d0d70167b3d
MD5 (05-Peljatty_Humppa.mp3) = a789d1f7ad6b979f9dd6d4d07e5f6849

Of course the above command is the same thing as:
$ cksum -a MD5 *.mp3 >cksum.md5

The problems start if you're dumb enough to keep the original copy of
your humppa on something other than a BSD system...

Since you can install OpenSSL on a number of different types of systems,
my first thought was to use OpenSSL to generate the checksum files.

$ find . -type f -name '*.mp3' -print0 | xargs -0 openssl md5 -out
ossl.md5

That get's you fairly close but the resulting format is wrong.

MD5(./01-Hump.mp3)= 1ecc9c0165043bda9ac07ae35a627cc4
MD5(./02-Humppakonehumppa.mp3)= 0c1cb2e6347b541830125dfcc41a6f00
MD5(./03-Humppamedia.mp3)= d0ee034280d835894e859258a5df4d8f
MD5(./04-Punakka_Humppa.mp3)= b768d3491261f1b256ba2d0d70167b3d
MD5(./05-Peljatty_Humppa.mp3)= a789d1f7ad6b979f9dd6d4d07e5f6849

Notice we're missing two of the required spaces as per cksum(1)

Sure, you can edit the above rather easily to produce the correct format
for BSD md5/cksum but why should we be doing that all of the time.

The GNU has their own incomplete and incompatible file format for MD5
checksums which is used with their ``md5sum'' tool.

$ md5sum *.mp3 >md5sum.md5

Which results in:
1ecc9c0165043bda9ac07ae35a627cc4 *01-Hump.mp3
0c1cb2e6347b541830125dfcc41a6f00 *02-Humppakonehumppa.mp3
d0ee034280d835894e859258a5df4d8f *03-Humppamedia.mp3
b768d3491261f1b256ba2d0d70167b3d *04-Punakka_Humppa.mp3
a789d1f7ad6b979f9dd6d4d07e5f6849 *05-Peljatty_Humppa.mp3

The gnu md5sum tool lacks designation of the message digest used.

Would it be worthwhile to add a format switch (maybe "-f") to cksum so
we can handle different file formats?

$ cksum -f openssl -c ossl.md5
$ cksum -f md5sum -c md5sum.md5

Is there some unstated reasoning why we don't support the other formats?

Since the format we use in OpenBSD quite nice:
  Would it be better to fix/augment the output of OpenSSL?
  Would it be better to fix/augment the output of md5sum?

Is there a better way to handle cross-os file validation?

And lastly NO, I don't actually believe my liver would survive listening
to 480GB of Humppa MP3's but the experiment might be, well,
intoxicating. (;

Thanks,
JCR


--
Free, Open Source CAD, CAM and EDA Tools
http://www.DesignTools.org

Reply via email to