#!/usr/bin/perl -w
#
# $Revision: 1.3 $ $Date: 2012-07-26 17:11:47-04 $
# $Source: /home/vogelke/bin/RCS/haval,v $
# $Host: sys7.com $
# $UUID: 3bd91874-b800-3e37-824d-7728b43a1bf4 $
#
#< haval: compute Haval signature for files or stdin

use strict;
use Digest::Haval256;

my $haval = new Digest::Haval256 or die;
my $fh;

@ARGV = ("-") unless @ARGV;    # handle stdin.

for my $file (@ARGV) {
    if (open($fh, "< $file")) {
        $haval->addfile($fh);
        close($fh);
        print $haval->hexdigest(), " $file\n";
        $haval->reset();
    }
    else {
        warn "$file: $!\n";
    }
}

exit(0);
