diff options
-rw-r--r-- | scripts/make-hashes.pl | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/scripts/make-hashes.pl b/scripts/make-hashes.pl index 96953ccc..6676992e 100644 --- a/scripts/make-hashes.pl +++ b/scripts/make-hashes.pl @@ -6,9 +6,8 @@ use strict; my $openssl = "/u/sra/isc/route-pki/subvert-rpki.hactrn.net/openssl/trunk/apps/openssl"; my $dir = "hashed"; -my %dirs; my @cmds; -my %count; +my %hashes; exit unless (@ARGV); @@ -21,21 +20,21 @@ while (<F>) { chomp; my $f = $_; my $type = /\.cer$/ ? "x509" : "crl"; + $_ = "$dir/$f"; + s=/[^/]+$==; + my $d = $_; my $h = `$openssl $type -inform DER -in $f -noout -hash`; chomp($h); $h .= "."; $h .= "r" if ($type eq "crl"); - my $n = 0 + $count{$h}++; - $_ = "$dir/$f"; - s=/[^/]+$==; - $dirs{$_} = 1; - push(@cmds, "$openssl $type -inform DER -outform PEM -out $_/$h$n -in $f\n"); + $h .= 0 + $hashes{$d}{$h}++; + push(@cmds, "$openssl $type -inform DER -outform PEM -out $d/$h -in $f\n"); } close(F); print("test -d $_ || mkdir -p $_\n") - foreach (sort(keys(%dirs))); + foreach (sort(keys(%hashes))); print($_) foreach (@cmds); |