poor man's cfv/cksfv (CRC checksum)

Lately I wanted to compute CRC-32 checksums for some videos. At first, I took a look at Digest::CRC and wrote this one-liner:

perl -MDigest::CRC=crc32_hex -E 'say crc32_hex <>' file.mkv

But of course that didn't work, since I was only reading a line off the first file in @ARGV. Realizing I need to read in the file, I added IO::All in the mix:

perl -MDigest::CRC=crc32_hex -MIO::All -E 'say crc32_hex io($ARGV[0])->all' file.mkv

That worked, but it was too slow since it read files into a string, and I was dealing with large (~1GB) file sizes. After a bit of looking around, I found the Digest::file module, so my one-liner finally becomes:

perl -MDigest::file=digest_file_hex -E 'say "$_ cksum: \U@{[digest_file_hex $_, q|CRC-32|]}\E" for @ARGV' file1.mkv file2.mkv files*.avi

Of course, I could have gotten something like cfv or cksfv from my Ubuntu repository, but curiosity got the better of me ;)

(edited: make use of perl's -E switch to implicitly enable features.)

Password Checkers

A colleague @$WORK found this: The Development of a Perl-based Password Complexity Filter. I was going to comment in the site about the presented Perl code looking rather like it was a straight shell script port (though the "use strict" pragma and lexicals indicate some safety, but I'm sure the more experienced Perl hackers here can smell worse.) Too bad it needs approved registration.

But that's not what I'm really wondering; are there more password checkers out there in the CPAN? I've seen ="http://metacpan.org/module/Data…

Joining blogs.perl.org

It has been a while since I've blogged, even more so over a webapp such as this. It has been quite some time even for my own personal blog, which I'm now considering to retire as so much of what I share usually now goes to Plurk (and recently, Google+.) Still, I would like to write more about my Perl experiences in depth, so getting an account on this side sounds like a good idea.

Oh, BTW, introductions are in order: I'm Zak, just another P…

About Zak B. Elep

user-pic Hacker, Gamer, Student. Runs Ubuntu on laptops, OpenBSD on servers, and Perl on everything.