etc/services - sync with NetBSD-8
[minix.git] / crypto / external / bsd / openssl / dist / util / sp-diff.pl
blob9d6c60387fa1c862f4c3fe4a4fe86a30c48e60ee
1 #!/usr/local/bin/perl
3 # This file takes as input, the files that have been output from
4 # ssleay speed.
5 # It prints a table of the relative differences with %100 being 'no difference'
8 ($#ARGV == 1) || die "$0 speedout1 speedout2\n";
10 %one=&loadfile($ARGV[0]);
11 %two=&loadfile($ARGV[1]);
13 $line=0;
14 foreach $a ("md2","md4","md5","sha","sha1","rc4","des cfb","des cbc","des ede3",
15 "idea cfb","idea cbc","rc2 cfb","rc2 cbc","blowfish cbc","cast cbc")
17 if (defined($one{$a,8}) && defined($two{$a,8}))
19 print "type 8 byte% 64 byte% 256 byte% 1024 byte% 8192 byte%\n"
20 unless $line;
21 $line++;
22 printf "%-12s ",$a;
23 foreach $b (8,64,256,1024,8192)
25 $r=$two{$a,$b}/$one{$a,$b}*100;
26 printf "%12.2f",$r;
28 print "\n";
32 foreach $a (
33 "rsa 512","rsa 1024","rsa 2048","rsa 4096",
34 "dsa 512","dsa 1024","dsa 2048",
37 if (defined($one{$a,1}) && defined($two{$a,1}))
39 $r1=($one{$a,1}/$two{$a,1})*100;
40 $r2=($one{$a,2}/$two{$a,2})*100;
41 printf "$a bits %% %6.2f %% %6.2f\n",$r1,$r2;
45 sub loadfile
47 local($file)=@_;
48 local($_,%ret);
50 open(IN,"<$file") || die "unable to open '$file' for input\n";
51 $header=1;
52 while (<IN>)
54 $header=0 if /^[dr]sa/;
55 if (/^type/) { $header=0; next; }
56 next if $header;
57 chop;
58 @a=split;
59 if ($a[0] =~ /^[dr]sa$/)
61 ($n,$t1,$t2)=($_ =~ /^([dr]sa\s+\d+)\s+bits\s+([.\d]+)s\s+([.\d]+)/);
62 $ret{$n,1}=$t1;
63 $ret{$n,2}=$t2;
65 else
67 $n=join(' ',grep(/[^k]$/,@a));
68 @k=grep(s/k$//,@a);
70 $ret{$n, 8}=$k[0];
71 $ret{$n, 64}=$k[1];
72 $ret{$n, 256}=$k[2];
73 $ret{$n,1024}=$k[3];
74 $ret{$n,8192}=$k[4];
77 close(IN);
78 return(%ret);