File: jhash.pl

package info (click to toggle)
libdigest-jhash-perl 0.10-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 172 kB
  • sloc: perl: 297; makefile: 3
file content (20 lines) | stat: -rw-r--r-- 410 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl -w
use strict;
use Digest::JHash 'jhash';

if ($ARGV[0]) {
    if ( -f $ARGV[0] ) {
        local $/;
        open F, $ARGV[0] or die "Can't read $ARGV[0] $!\n";
        my $data = <F>;
        close F;
        printf "File: $ARGV[0] => %u\n", jhash($data);
    }
    else {
        printf "String: $ARGV[0] => %u\n", jhash($ARGV[0]);
    }
}
else {
    print "Usage $0 <file or string>\n";
}