Files Integrity Check

Okay, imagine a situation like this; you downloaded a files, in the end you notice that the file is corrupted and you have to redownload the files again. But there are certain scenarios that even though it’s corrupted, it’s still can be executed. For example video files. But due to the file corrupt problem, there are some glitches in the video. In some cases, it’s nice to know whether our downloaded files contains error or not as soon as possible. There are many ways or tools to use to check the files integrity. This kind of tools or techniques involved the usage of cryptographic hash functions (eg: SHA1, md5) and redundancy check functions (among others). Among the most popular method been used is Cyclic Redundancy Check (CRC).

All right, we’ll look into a practical part and for that purpose I’ll use “[Shinsen-Subs]_Le_Chevalier_D’Eon_-_01_[6BD7BF33].avi” filename as an example. On a side notes, the example file is a video files (an anime to be exact) and as most fansubbers, they tend to include the CRC value at the end of their releases file name (the CRC value of that file is ‘6BD7BF33’). So basically, to check the file integrity, we will compute the CRC value of the file and compare it with the given CRC value. If it’s the same, safe to say that there are nothing wrong with the file and vice versa. For a little of howto demonstration, I will classify it into two different platform; Linux and Windows.

Linux (Using Ubuntu Feisty Fawn 7.04)

Don’t panic if you have other distro (Fedora, SuSe, etc), it’s still the same method either way. Ok, using the terminal, change the directory into the folder where the target files to be check resides (example below).

overlord666@overlord666-altar:~$ cd Le*
overlord666@overlord666-altar:~/Le Chevalier d'Eon$

After that, type the command crc32 “your_filename” as shown below and press enter:

crc32 "[Shinsen-Subs]_Le_Chevalier_D'Eon_-_01_[6BD7BF33].avi"

The command above will print the CRC value and you can compare it with the given value. If you want to compute CRC value for all files in the particular folder just replace the filename (including the double quote sign) with * (asterisk sign). Simple isn’t it? Now if you encounter an error such as crc32 not found or install, try to install it first. Usually it will tell you what kind of package that you don’t have to run crc32. In my case, initially I didn’t install the tools so there’s an error and a reminder that asked me to install the needed package and I just follow the reminder (as shown below).

The program ‘crc32’ is currently not installed. You can install it by typing:

sudo apt-get install libarchive-zip-perl

Other than CRC value, usually in case of batch download (more than one files downloaded), the files creator tend to send an extra files so you can use it to verify all the files integrity. The usual extra files used were SFV and MD5 files. SFV is just a file format for storing CRC32 checksums of files. To verify using sfv file, I’m using a simple program called cksfv. Just open terminal and type “cksfv -f mysfvfile.sfv” (example below). The output will verify the integrity of your files:

cksfv -f [Shinsen-Subs].sfv

While md5 verification is not much different from sfv. The general syntax is “md5sum -c mymd5file.md5” (example below). The output will also verify your files integrity:

md5sum -c sums.md5

Microsoft Windows XP

I do feel that I don’t need to elaborate in details about files integrity checking in Windows. Why? Because honestly, there are many freeware tools for Windows user to check their crc or sfv. And most of them comes with user interface and it shouldn’t take long to know how to use it (mostly support drag and drop features). One of my favorite tools in this department is QuickSFV. It contains all the basic features that needed to verify file’s integrity namely a quick verifications and creating sfv files. If you prefer just a simple checker, you can also try CRC32Finder. Or if you kind of greedy, try HashCalc; it can verify a choice of 13 of the most popular hash and checksum algorithms for calculations.


A corrupted files can be very frustrated if it being discovered on the last minute (watching video files and suddenly the audio lost!!??). So, verify the integrity first to avoid such frustration. Actually it’s not limited to video files only, it covers all types of files (providing you know the real or original CRC/md5/sha1 value that is). Real example is when I downloaded a Fedora iso files; before burn it into a blank DVD, I check the integrity by using sha1. The general syntax is sha1sum [OPTION] [FILE]. Example of sha1sum’s content (below):

Hash: SHA1

96b13dbbc9f3bc569ddad9745f64b9cdb43ea9ae F-7-i386-DVD.iso
fc2e7ab25550afb78608c7f432d0af6c6a7b2105 F-7-i386-rescuecd.iso
Version: GnuPG v1.4.7 (GNU/Linux)


Type the command in terminal (sha1sum -c SHA1SUM). The SHA1SUM is the name of the sha1 files and “-c” option indicate that we intend to check SHA1 sums against the given list (SHA1SUM). I just make sure the SHA1SUM is in the same folder with the iso files that I want to check. And that’s all for now and I do hope my post will bring any benefit to you. See ya’….

Tags: , , , , ,

  • Heh, thanks for this page – Before reading it I did something really stupid, but I’m *really* tired… I ran sha1sum F-7-i386-rescuecd.iso, then copied the correct sum from SHA1SUM file and wrote this command in bash:
    if [ “fc2e7ab25550afb78608c7f432d0af6c6a7b2105” = “fc2e7ab25550afb78608c7f432d0af6c6a7b2105” ] ; then echo ok ; fi

    Of course that does say ‘ok’ if it’s correct, but while innovative in really tired and stupid way I felt both biggest fool and relieved to realize that the supposed solution was intelligent and handy unlike my tired WinnerIdea :D
    I hope this gives you a laugh too :D

  • Hahaha…yeah it’s give me a laugh…I assume you’re a programmer or at least “was”….nevertheless, glad my page benefits you…