Skip to main content
  • Home
  • login
  • Browse the archive

    swh mirror partner logo
swh logo
SoftwareHeritage
Software
Heritage
Mirror
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • c7b1687
  • /
  • crypto
  • /
  • des
  • /
  • doPC2
Raw File
Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge Iframe embedding
swh:1:cnt:fa5cf74cf71319dbedb4ad3ea923009b91e623e6
directory badge Iframe embedding
swh:1:dir:61110eecdb13008fafc2fb7d991b52a1611f1518
doPC2
#!/usr/local/bin/perl

@PC2_C=(14,17,11,24, 1, 5,
	 3,28,15, 6,21,10,
	23,19,12, 4,26, 8,
	16, 7,27,20,13, 2,
	);

@PC2_D=(41,52,31,37,47,55,
	30,40,51,45,33,48,
	44,49,39,56,34,53,
	46,42,50,36,29,32,
	);

$i=0;
foreach (@PC2_C) {
	$_--;
#	printf "%2d,",$_;
	$C{$_}=$i;
	++$i;
#	print "\n" if ((($i) % 8) == 0);
	}
$i=0;
#print "\n";
foreach (@PC2_D) {
	$_-=28;
	$_--;
#	printf "%2d,",$_;
	$D{$_}=$i;
	$i++;
#	print "\n" if ((($i) % 8) == 0);
	}

#print "\n";
foreach $i (0 .. 27)
	{
	$_=$C{$i};
#	printf "%2d,",$_;
	$i++;
#	print "\n" if ((($i) % 8) == 0);
	}
#print "\n";

#print "\n";
foreach $i (0 .. 27)
	{
	$_=$D{$i};
#	printf "%2d,",$_;
	$i++;
#	print "\n" if ((($i) % 8) == 0);
	}
#print "\n";

print "static ulong skb[8][64]={\n";
&doit("C",*C, 0, 1, 2, 3, 4, 5);
&doit("C",*C, 6, 7, 9,10,11,12);
&doit("C",*C,13,14,15,16,18,19);
&doit("C",*C,20,22,23,25,26,27);

&doit("D",*D, 0, 1, 2, 3, 4, 5);
&doit("D",*D, 7, 8,10,11,12,13);
&doit("D",*D,15,16,17,18,19,20);
&doit("D",*D,21,22,23,24,26,27);
print "};\n";

sub doit
	{
	local($l,*A,@b)=@_;
	local(@out);

	printf("/* for $l bits (numbered as per FIPS 46) %d %d %d %d %d %d */\n",
		$b[0]+1, $b[1]+1, $b[2]+1, $b[3]+1, $b[4]+1, $b[5]+1);
	for ($i=0; $i<64; $i++)
		{
		$out[$i]=0;
		$j=1;
#print "\n";
		for ($k=0; $k<6; $k++)
			{
			$l=$A{$b[$k]};
#print"$l - ";
			if ((1<<$k) & $i)
				{
				$ll=int($l/6)*8+($l%6);
				$out[$i]|=1<<($ll);
				}
			}
		$pp=$out[$i];
		$pp=($pp&0xff0000ff)|   (($pp&0x00ff0000)>>8)|
					(($pp&0x0000ff00)<<8);
		printf("0x%08X,",$pp);
		print "\n" if (($i+1) % 4 == 0);
		}
	}

ENEA — Copyright (C), ENEA. License: GNU AGPLv3+.
Legal notes  ::  JavaScript license information ::  Web API

back to top