St0rY oF uNpReDiCtAbLe LiFe II
.:My Continuous Whining About Life~sighh~:.
rss
email
twitter
facebook
  • About
  • Archives
  • My Rig Specs
  • My Watch-list

Files Integrity Check

2 comments
Posted on Sep 21 2007 by Amir Hamzah

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).

1
2
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.

Conclusion

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):

—–BEGIN PGP SIGNED MESSAGE—–
Hash: SHA1

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

iD8DBQFGWfrHtEJp0E8qb9IRAlKbAJ4lFgv2g1t2HHkx9qBR+MICRTjEZACeKW1G
PARJf/frcaGIB27Lw8R3Nng=
=GQMy
—–END PGP SIGNATURE—–

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’….

  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

  Tags: cksfv, crc, CRC32Finder, md5, QuickSFV, sha1 Category: Linux, MS Windows, Tips & Howto

2 Comments

  1. Robsku says:
    Friday, 21 March 2008 at 3:16 pm

    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

    ReplyReply

    Reply

  2. Amir Hamzah says:
    Saturday, 22 March 2008 at 12:12 am

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

    ReplyReply

    Reply

Leave a Reply

Click here to cancel reply.




CommentLuv Enabledshow more
:mrgreen: :twisted: :evil: :oops: :roll: :cry: :lol: :cool: :shock: :sad: :smile: :???: :grin: :razz: :eek: :mad: :neutral: :wink: :!: :$: :?: :XO: :vangry: :up: :down: :arrow: :halo: :kiss:

Click to cancel reply

Pages

  • About
  • Archives
  • My Rig Specs
  • My Watch-list

Latest Comments

  • ParsonsELBA on Fedora Core 5
  • HillarySCHROEDER on Fedora Core 5
  • Anonymous on SAKTI’s 12th Anniversary
  • Amir Hamzah on Cigarettes Price Increase
  • Salvia Divinorum on Cigarettes Price Increase

My Tweets

  • Meeting commence yaaay~ 30 mins ago
  • Seeing Edison Cavani on the field, kinda take me back during the time I played Football Manager 2009 #worldcup #fm2009 2010-06-26
  • Already the first goal from Uruguay~ #worldcup 2010-06-26
  • Watching Uruguay VS Korea Republic #worldcup 2010-06-26
  • Italy following France? #worldcup 2010-06-24
  • More updates...

Blogroll

  • Adiputra
  • Cyza Sector
  • Mior Muhammad Zaki
  • MyPapit GNU/Linux
  • Please Name My Blog
  • reBETAvolution
  • The Right Angle
  • Ubuntu for Malaysian

I Recommend

  • Azureus
  • Browse Happy
  • Deviantart
  • Fedora Project
  • Foobar2000
  • Get Firefox
  • GIMP
  • GNome
  • Opera
  • PHP
  • Ubuntu
  • µTorrent

Tag cloud

crc forgiveness WAMP tv shows windows review EURO 2008 apache error ramadhan setup movie upgrade codec announcement cksfv mumbling phpmyadmin lcd soccer mysql play stuff IRDA job seeking CRC32Finder open source ubuntu nbtd Personal arsenal life Microsoft football list News domain fedora europe Music disaster install funny malaysia Release php

Readers


  • About
  • Archives
  • My Rig Specs
  • My Watch-list
Powered by Wordpress  |  Designed by WebTreats

This blog is protected by Dave's Spam Karma 2: 4606 Spams eaten and counting...