head	1.2;
access;
symbols
	RELENG_3_5_0_RELEASE:1.1.1.1
	RELENG_3_4_0_RELEASE:1.1.1.1
	RELENG_3_3_0_RELEASE:1.1.1.1
	RELENG_3_2_PAO:1.1.1.1.0.8
	RELENG_3_2_PAO_BP:1.1.1.1
	RELENG_3_2_0_RELEASE:1.1.1.1
	RELENG_3_1_0_RELEASE:1.1.1.1
	RELENG_3:1.1.1.1.0.6
	RELENG_3_BP:1.1.1.1
	RELENG_2_2_8_RELEASE:1.1.1.1
	RELENG_3_0_0_RELEASE:1.1.1.1
	RELENG_2_2_7_RELEASE:1.1.1.1
	RELENG_2_2_6_RELEASE:1.1.1.1
	RELENG_2_2_5_RELEASE:1.1.1.1
	RELENG_2_2_2_RELEASE:1.1.1.1
	RELENG_2_2_1_RELEASE:1.1.1.1
	RELENG_2_2_0_RELEASE:1.1.1.1
	RELENG_2_1_7_RELEASE:1.1.1.1
	RELENG_2_1_6_1_RELEASE:1.1.1.1
	RELENG_2_1_6_RELEASE:1.1.1.1
	RELENG_2_2:1.1.1.1.0.4
	RELENG_2_2_BP:1.1.1.1
	ssleay_0_6_3:1.1.1.1
	ssleay_0_6_2:1.1.1.1
	ssleay_0_6_1:1.1.1.1
	RELENG_2_1_5_RELEASE:1.1.1.1
	RELENG_2_1_0:1.1.1.1.0.2
	des_051a:1.1.1.1
	EAY:1.1.1;
locks; strict;
comment	@# @;


1.2
date	99.09.19.18.49.48;	author markm;	state dead;
branches;
next	1.1;

1.1
date	96.02.10.15.32.24;	author markm;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	96.02.10.15.32.24;	author markm;	state Exp;
branches;
next	;


desc
@@


1.2
log
@libdes is bmaked and built from src/crypto/... now.
@
text
@#!/usr/local/bin/perl

@@l=(
	 0, 1, 2, 3, 4, 5, 6, 7,
	 8, 9,10,11,12,13,14,15,
	16,17,18,19,20,21,22,23,
	24,25,26,27,28,29,30,31
	);
@@r=(
	32,33,34,35,36,37,38,39,
	40,41,42,43,44,45,46,47,
	48,49,50,51,52,53,54,55,
	56,57,58,59,60,61,62,63
	);

require 'shifts.pl';

sub PERM_OP
	{
	local(*a,*b,*t,$n,$m)=@@_;

	@@z=&shift(*a,-$n);
	@@z=&xor(*b,*z);
	@@z=&and(*z,$m);
	@@b=&xor(*b,*z);
	@@z=&shift(*z,$n);
	@@a=&xor(*a,*z);
	}

sub HPERM_OP2
	{
	local(*a,*t,$n,$m)=@@_;
	local(@@x,@@y,$i);

	@@z=&shift(*a,16-$n);
	@@z=&xor(*a,*z);
	@@z=&and(*z,$m);
	@@a=&xor(*a,*z);
	@@z=&shift(*z,$n-16);
	@@a=&xor(*a,*z);
	}

sub HPERM_OP
        {
        local(*a,*t,$n,$m)=@@_;
        local(@@x,@@y,$i);

        for ($i=0; $i<16; $i++)
                {
                $x[$i]=$a[$i];
                $y[$i]=$a[16+$i];
                }
        @@z=&shift(*x,-$n);
        @@z=&xor(*y,*z);
        @@z=&and(*z,$m);
        @@y=&xor(*y,*z);
        @@z=&shift(*z,$n);
        @@x=&xor(*x,*z);
        for ($i=0; $i<16; $i++)
                {
                $a[$i]=$x[$i];
                $a[16+$i]=$y[$i];
                }
        }

@@L=@@l;
@@R=@@r;

	print "---\n"; &printit(@@R);
&PERM_OP(*R,*L,*T,4,0x0f0f0f0f);
	print "---\n"; &printit(@@R);
&HPERM_OP2(*L,*T,-2,0xcccc0000);
&HPERM_OP2(*R,*T,-2,0xcccc0000);
	print "---\n"; &printit(@@R);
&PERM_OP(*R,*L,*T,1,0x55555555);
	print "---\n"; &printit(@@R);
&PERM_OP(*L,*R,*T,8,0x00ff00ff);
	print "---\n"; &printit(@@R);
&PERM_OP(*R,*L,*T,1,0x55555555);
	print "---\n"; &printit(@@R);
#	&printit(@@L);
	&printit(@@R);
print <<"EOF";
==============================
63  55  47  39  31  23  15   7  
62  54  46  38  30  22  14   6  
61  53  45  37  29  21  13   5  
60  52  44  36  --  --  --  --  

57  49  41  33  25  17   9   1  
58  50  42  34  26  18  10   2  
59  51  43  35  27  19  11   3  
28  20  12   4  --  --  --  --  
EOF
exit(1);
@@A=&and(*R,0x000000ff);
@@A=&shift(*A,16);
@@B=&and(*R,0x0000ff00);
@@C=&and(*R,0x00ff0000);
@@C=&shift(*C,-16);
@@D=&and(*L,0xf0000000);
@@D=&shift(*D,-4);
@@A=&or(*A,*B);
@@B=&or(*D,*C);
@@R=&or(*A,*B);
@@L=&and(*L,0x0fffffff);

	&printit(@@L);
	&printit(@@R);

@


1.1
log
@Initial revision
@
text
@@


1.1.1.1
log
@This is the long-awaited new DES library. Over the next couple of days
will be properly built into the system.
@
text
@@
