summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/des/doPC2
diff options
context:
space:
mode:
authorcvs2svn <admin@example.com>1998-10-05 20:13:17 +0000
committercvs2svn <admin@example.com>1998-10-05 20:13:17 +0000
commite82f18fab47b698d93971f576f962a3068132912 (patch)
tree681519717892864935c3d0533cf171098afa649a /src/lib/libcrypto/des/doPC2
parent536c76cbb863bab152f19842ab88772c01e922c7 (diff)
downloadopenbsd-SSLeay_0_9_0b.tar.gz
openbsd-SSLeay_0_9_0b.tar.bz2
openbsd-SSLeay_0_9_0b.zip
This commit was manufactured by cvs2git to create tag 'SSLeay_0_9_0b'.SSLeay_0_9_0b
Diffstat (limited to 'src/lib/libcrypto/des/doPC2')
-rw-r--r--src/lib/libcrypto/des/doPC294
1 files changed, 94 insertions, 0 deletions
diff --git a/src/lib/libcrypto/des/doPC2 b/src/lib/libcrypto/des/doPC2
new file mode 100644
index 0000000000..fa5cf74cf7
--- /dev/null
+++ b/src/lib/libcrypto/des/doPC2
@@ -0,0 +1,94 @@
1#!/usr/local/bin/perl
2
3@PC2_C=(14,17,11,24, 1, 5,
4 3,28,15, 6,21,10,
5 23,19,12, 4,26, 8,
6 16, 7,27,20,13, 2,
7 );
8
9@PC2_D=(41,52,31,37,47,55,
10 30,40,51,45,33,48,
11 44,49,39,56,34,53,
12 46,42,50,36,29,32,
13 );
14
15$i=0;
16foreach (@PC2_C) {
17 $_--;
18# printf "%2d,",$_;
19 $C{$_}=$i;
20 ++$i;
21# print "\n" if ((($i) % 8) == 0);
22 }
23$i=0;
24#print "\n";
25foreach (@PC2_D) {
26 $_-=28;
27 $_--;
28# printf "%2d,",$_;
29 $D{$_}=$i;
30 $i++;
31# print "\n" if ((($i) % 8) == 0);
32 }
33
34#print "\n";
35foreach $i (0 .. 27)
36 {
37 $_=$C{$i};
38# printf "%2d,",$_;
39 $i++;
40# print "\n" if ((($i) % 8) == 0);
41 }
42#print "\n";
43
44#print "\n";
45foreach $i (0 .. 27)
46 {
47 $_=$D{$i};
48# printf "%2d,",$_;
49 $i++;
50# print "\n" if ((($i) % 8) == 0);
51 }
52#print "\n";
53
54print "static ulong skb[8][64]={\n";
55&doit("C",*C, 0, 1, 2, 3, 4, 5);
56&doit("C",*C, 6, 7, 9,10,11,12);
57&doit("C",*C,13,14,15,16,18,19);
58&doit("C",*C,20,22,23,25,26,27);
59
60&doit("D",*D, 0, 1, 2, 3, 4, 5);
61&doit("D",*D, 7, 8,10,11,12,13);
62&doit("D",*D,15,16,17,18,19,20);
63&doit("D",*D,21,22,23,24,26,27);
64print "};\n";
65
66sub doit
67 {
68 local($l,*A,@b)=@_;
69 local(@out);
70
71 printf("/* for $l bits (numbered as per FIPS 46) %d %d %d %d %d %d */\n",
72 $b[0]+1, $b[1]+1, $b[2]+1, $b[3]+1, $b[4]+1, $b[5]+1);
73 for ($i=0; $i<64; $i++)
74 {
75 $out[$i]=0;
76 $j=1;
77#print "\n";
78 for ($k=0; $k<6; $k++)
79 {
80 $l=$A{$b[$k]};
81#print"$l - ";
82 if ((1<<$k) & $i)
83 {
84 $ll=int($l/6)*8+($l%6);
85 $out[$i]|=1<<($ll);
86 }
87 }
88 $pp=$out[$i];
89 $pp=($pp&0xff0000ff)| (($pp&0x00ff0000)>>8)|
90 (($pp&0x0000ff00)<<8);
91 printf("0x%08X,",$pp);
92 print "\n" if (($i+1) % 4 == 0);
93 }
94 }