src/Tools/Cache_IO/lib/scripts/compute_hash_key
author huffman
Tue, 23 Mar 2010 19:03:05 -0700
changeset 35940 a336af707767
parent 35151 117247018b54
permissions -rwxr-xr-x
merged
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35151
117247018b54 added Cache_IO: cache for output of external tools,
boehmes
parents:
diff changeset
     1
#!/usr/bin/env perl
117247018b54 added Cache_IO: cache for output of external tools,
boehmes
parents:
diff changeset
     2
#
117247018b54 added Cache_IO: cache for output of external tools,
boehmes
parents:
diff changeset
     3
# Author: Sascha Boehme, TU Muenchen
117247018b54 added Cache_IO: cache for output of external tools,
boehmes
parents:
diff changeset
     4
#
117247018b54 added Cache_IO: cache for output of external tools,
boehmes
parents:
diff changeset
     5
# Compute MD5 hash key.
117247018b54 added Cache_IO: cache for output of external tools,
boehmes
parents:
diff changeset
     6
117247018b54 added Cache_IO: cache for output of external tools,
boehmes
parents:
diff changeset
     7
use strict;
117247018b54 added Cache_IO: cache for output of external tools,
boehmes
parents:
diff changeset
     8
use warnings;
117247018b54 added Cache_IO: cache for output of external tools,
boehmes
parents:
diff changeset
     9
use Digest::MD5;
117247018b54 added Cache_IO: cache for output of external tools,
boehmes
parents:
diff changeset
    10
117247018b54 added Cache_IO: cache for output of external tools,
boehmes
parents:
diff changeset
    11
117247018b54 added Cache_IO: cache for output of external tools,
boehmes
parents:
diff changeset
    12
# argument
117247018b54 added Cache_IO: cache for output of external tools,
boehmes
parents:
diff changeset
    13
117247018b54 added Cache_IO: cache for output of external tools,
boehmes
parents:
diff changeset
    14
my $file = $ARGV[0];
117247018b54 added Cache_IO: cache for output of external tools,
boehmes
parents:
diff changeset
    15
117247018b54 added Cache_IO: cache for output of external tools,
boehmes
parents:
diff changeset
    16
117247018b54 added Cache_IO: cache for output of external tools,
boehmes
parents:
diff changeset
    17
# compute MD5 hash key
117247018b54 added Cache_IO: cache for output of external tools,
boehmes
parents:
diff changeset
    18
117247018b54 added Cache_IO: cache for output of external tools,
boehmes
parents:
diff changeset
    19
my $md5 = Digest::MD5->new;
117247018b54 added Cache_IO: cache for output of external tools,
boehmes
parents:
diff changeset
    20
open FILE, "<$file" or die "ERROR: Failed to open '$file' ($!)";
117247018b54 added Cache_IO: cache for output of external tools,
boehmes
parents:
diff changeset
    21
$md5->addfile(*FILE);
117247018b54 added Cache_IO: cache for output of external tools,
boehmes
parents:
diff changeset
    22
close FILE;
117247018b54 added Cache_IO: cache for output of external tools,
boehmes
parents:
diff changeset
    23
print $md5->b64digest . "\n";
117247018b54 added Cache_IO: cache for output of external tools,
boehmes
parents:
diff changeset
    24