Mercurial > ec-dotfiles
diff bin/cek.rb @ 4:94ee419ad047
Added bin-ec - a collection of scripts.
author | Edho Prima Arief <me@myconan.net> |
---|---|
date | Sat, 10 Jul 2010 12:38:52 +0000 |
parents | |
children | 72c299437fde |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/cek.rb Sat Jul 10 12:38:52 2010 +0000 @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby +require 'zlib' + +block = 1048576 +ARGV.each do |filename| + crc = 0 + file = File.open(filename, 'rb') + currentbyte = 0 + while (line = file.read(block)) do + crc = Zlib.crc32(line,crc) + end + file.close + printf("%s %08X\n", filename, crc.to_s) +end