Mercurial > ec-dotfiles
annotate bin/cek.rb @ 495:fea77cdcdb09
Size-customizable pwgen.
author | edogawaconan <me@myconan.net> |
---|---|
date | Fri, 20 Dec 2013 20:17:00 +0900 |
parents | 324c5842af87 |
children | a0f4a3e15322 |
rev | line source |
---|---|
4
94ee419ad047
Added bin-ec - a collection of scripts.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
1 #!/usr/bin/env ruby |
94ee419ad047
Added bin-ec - a collection of scripts.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
2 require 'zlib' |
94ee419ad047
Added bin-ec - a collection of scripts.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
3 |
94ee419ad047
Added bin-ec - a collection of scripts.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
4 block = 1048576 |
94ee419ad047
Added bin-ec - a collection of scripts.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
5 ARGV.each do |filename| |
486 | 6 crc = 0 |
7 file = File.open(filename, 'rb') | |
8 currentbyte = 0 | |
9 while (line = file.read(block)) do | |
10 crc = Zlib.crc32(line,crc) | |
11 end | |
12 file.close | |
13 printf("%s %08X\n", filename, crc.to_i) | |
4
94ee419ad047
Added bin-ec - a collection of scripts.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
14 end |