Checksum

It is advisable to verify the integrity of large files as CD and DVD images and files being downloaded though the net. Additionally checksum algorithm get used by many cryptographic and secure applications. As usual under Linux, there are different ways to create check sums:

MD5 Message-Digest algorithm 5

See: RFC 1321 it is a commonly used algorithm.

There are different ways to deal with MD5:

  1. Download and produce checksum of it, them verify it by the checksum published: KNOPPIX_V5.3.1DVD-2008-03-26-EN.iso

    4ccda04355e63d1485072f8906465168 KNOPPIX_V5.3.1DVD-2008-03-26-EN.iso

  2. Contents of the md5 file is (except *) the same as the result of md5sum

    cat KNOPPIX_V5.3.1DVD-2008-03-26-EN.iso.md5

    4ccda04355e63d1485072f8906465168 KNOPPIX_V5.3.1DVD-2008-03-26-EN.iso

  3. Download ISO and md5 file

    Example Knoppix DVD

    md5sum -c KNOPPIX_V5.3.1DVD-2008-03-26-EN.iso.md5

    KNOPPIX_V5.3.1DVD-2008-03-26-EN.iso: OK

    The -c option points to a file that has the md5sum and the filename to be verified. A * character is put in front of the filename to mark it as a binary file, otherwise it is considered as text file. The checksum files can contain multiple lines to support multiple files to be checked. Also lines starting with # can be in the files to add comments.

    Note: Between checksum and filename maximum one space character is allowed.

  4. To get the md5sum of a physical dvd and not a iso image and assuming it is accessible on the mounted /dev/hdc type:

    dd if=/dev/hdc bs=2k count=$(($(isosize /dev/hdc)/2048)) | md5sum

    2171297+0 records in

    2171297+0 records out

    4446816256 bytes (4.4 GB) copied, 916.757 s, 4.9 MB/s

    4ccda04355e63d1485072f8906465168 -

    This way a DVD/CD can be verified with the md5sum of an ISO image. See dd

  5. or much easier way would be assuming hdc is the cd drive

    md5sum /dev/hdc

    85bb4695004e9edd52414f34a572eedb /dev/hdc

    but the checksum is different due to additional stuff on the dvd.

The man page man md5sum does not show all details especially the -c option and the checksum files, therefore check the info page using info coreutils 'md5sum invocation'.

To perform more md5 operations emerge md5deep to get the two programs md5deep and hashdeep

http://md5deep.sourceforge.net/start-md5deep.html

http://md5deep.sourceforge.net/start-hashdeep.html

SHA-1 and SHA-2

Those Secure Hash Algorithm are considered as successor of the MD5 algorithm. SHA-2 actually does not exist, it is a synonym for one out of the following four algorithm: SHA-224, SHA-256, SHA-384 and SHA-512.

Commands are:

sha1sum

sha224sum

sha256sum

sha384sum

sha512sum

For the details see the man pages.

MD160

MD160 is an other hash algorithm are considered commonly used in OpenBSD. RMD160 is defined in the standard ISO/IEC10118-3. MD160 is a short form of

RIPEMD-160 (RACE Integrity Primitives Evaluation Message Digest) where RACE means Research and Development in Advanced Communications Technologies in Europe.

Integrity of CD/DVD's

DVD's and CD store the data in a high redundant matter. It does not stop just there when it comes to error detection, it can also do error correction. Since CD's and DVD have a limited lifetime of some 10 years it is wise to verify the integrity of your CD's and DVD's and emerge dvdisaster. It has a nice GUI and is ready to go.

There are two files involved the well known ISO image (*.iso) that is ready to be used and the and the parity file (*.ecc) that contains the redundant data.


Linurs startpage