Mercurial > ec-dotfiles
changeset 614:70355e17653e
Use zlib which is more available
author | nanaya <me@nanaya.pro> |
---|---|
date | Mon, 02 Apr 2018 17:45:56 +0900 |
parents | 1a996b35eaab |
children | c021db8fb794 |
files | bin/cek.pl |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/cek.pl Mon Apr 02 17:44:25 2018 +0900 +++ b/bin/cek.pl Mon Apr 02 17:45:56 2018 +0900 @@ -2,7 +2,7 @@ use strict; use warnings; -use String::CRC32; +use Compress::Zlib; use File::Basename; my @files = @ARGV or print("Usage: ",basename($0)," file1 file2 ... fileN\n") && exit(1); @@ -28,8 +28,13 @@ open(FILE,"<",$filename); binmode(FILE); - $real_crc = sprintf("%08X",crc32(*FILE)); + my $file_crc = 0; + my $file_part = ''; + while (read(FILE, $file_part, 4096)) { + $file_crc = crc32($file_part, $file_crc); + } close(FILE); + $real_crc = sprintf("%08X", $file_crc); if ($name_crc) { $num_na--;