Merge from vendor branch NCURSES:
[dragonfly.git] / crypto / heimdal-0.6.3 / lib / des / doIP
1 #!/usr/local/bin/perl
2
3 @l=(
4          0, 1, 2, 3, 4, 5, 6, 7,
5          8, 9,10,11,12,13,14,15,
6         16,17,18,19,20,21,22,23,
7         24,25,26,27,28,29,30,31
8         );
9 @r=(
10         32,33,34,35,36,37,38,39,
11         40,41,42,43,44,45,46,47,
12         48,49,50,51,52,53,54,55,
13         56,57,58,59,60,61,62,63
14         );
15
16 require 'shifts.pl';
17
18 sub PERM_OP
19         {
20         local(*a,*b,*t,$n,$m)=@_;
21
22         @z=&shift(*a,-$n);
23         @z=&xor(*b,*z);
24         @z=&and(*z,$m);
25         @b=&xor(*b,*z);
26         @z=&shift(*z,$n);
27         @a=&xor(*a,*z);
28         }
29
30
31 @L=@l;
32 @R=@r;
33 &PERM_OP(*R,*L,*T,4,0x0f0f0f0f);
34 &PERM_OP(*L,*R,*T,16,0x0000ffff);
35 &PERM_OP(*R,*L,*T,2,0x33333333);
36 &PERM_OP(*L,*R,*T,8,0x00ff00ff);
37 &PERM_OP(*R,*L,*T,1,0x55555555);
38         &printit(@L);
39         &printit(@R);
40 &PERM_OP(*R,*L,*T,1,0x55555555);
41 &PERM_OP(*L,*R,*T,8,0x00ff00ff);
42 &PERM_OP(*R,*L,*T,2,0x33333333);
43 &PERM_OP(*L,*R,*T,16,0x0000ffff);
44 &PERM_OP(*R,*L,*T,4,0x0f0f0f0f);
45         &printit(@L);
46         &printit(@R);