|
|
#include<iostream>
|
|
|
#include<cstdlib>
|
|
|
#include<stdio.h>
|
|
|
#include<cstring>
|
|
|
#include<fstream>
|
|
|
int E[48] = { 32,1,2,3,4,5,4,5,6,7,8,9,8,9,10,11,12,13,12,13,14,15,16,17,16,17,18,19,20,21,20,21,22,23,24,25,24,25,26,27,28,29,28,29,30,31,32,1 };
|
|
|
int Pc[32] = { 9,17,23,31,13,28,2,18,24,16,30,6,26,20,10,1,8,14,25,3,4,29,11,19,32,12,22,7,5,27,15,21 };
|
|
|
int PC1c[64] = { 8,16,24,56,52,44,36,57,7,15,23,55,51,43,35,58,6,14,22,54,50,42,34,59,5,13,21,53,49,41,33,60,4,12,20,28,48,40,32,61,3,11,19,27,47,39,31,62,2,10,18,26,46,38,30,63,1,9,17,25,45,37,29,64 };
|
|
|
int PCr[48] = { 14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32 };
|
|
|
int P[32] = { 16,7,20,21,29,12,28,17,1,15,23,26,5,18,31,10,2,8,24,14,32,27,3,9,19,13,30,6,22,11,4,25 };
|
|
|
int S[8][4][16] = { {{14,4,13,1,2,15,11,8,3,10,6,12,5,9,0,7},{0,15,7,4,14,2,13,1,10,6,12,11,9,5,3,8},{4,1,14,8,13,6,2,11,15,12,9,7,3,10,5,0},{15,12,8,2,4,9,1,7,5,11,3,14,10,0,6,13}}\
|
|
|
,{{15,1,8,14,6,11,3,4,9,7,2,13,12,0,5,10},{3,13,4,7,15,2,8,14,12,0,1,10,6,9,11,5},{0,14,7,11,10,4,13,1,5,8,12,6,9,3,2,15},{13,8,10,1,3,15,4,2,11,6,7,12,0,5,14,9}}\
|
|
|
,{{10,0,9,14,6,3,15,5,1,13,12,7,11,4,2,8},{13,7,0,9,3,4,6,10,2,8,5,14,12,11,15,1},{13,6,4,9,8,15,3,0,11,1,2,12,5,10,14,7},{1,10,13,0,6,9,8,7,4,15,14,3,11,5,2,12}}\
|
|
|
,{{7,13,14,3,0,6,9,10,1,2,8,5,11,12,4,15},{13,8,11,5,6,15,0,3,4,7,2,12,1,10,14,9},{10,6,9,0,12,11,7,13,15,1,3,14,5,2,8,4},{3,15,0,6,10,1,13,8,9,4,5,11,12,7,2,14}}\
|
|
|
,{{2,12,4,1,7,10,11,6,8,5,3,15,13,0,14,9},{14,11,2,12,4,7,13,1,5,0,15,10,3,9,8,6},{4,2,1,11,10,13,7,8,15,9,12,5,6,3,0,14},{11,8,12,7,1,14,2,13,6,15,0,9,10,4,5,3}}\
|
|
|
,{{12,1,10,15,9,2,6,8,0,13,3,4,14,7,5,11},{10,15,4,2,7,12,9,5,6,1,13,14,0,11,3,8},{9,14,15,5,2,8,12,3,7,0,4,10,1,13,11,6},{4,3,2,12,9,5,15,10,11,14,1,7,6,0,8,13}}\
|
|
|
,{{4,11,2,14,15,0,8,13,3,12,9,7,5,10,6,1},{13,0,11,7,4,9,1,10,14,3,5,12,2,15,8,6},{1,4,11,13,12,3,7,14,10,15,6,8,0,5,9,2},{6,11,13,8,1,4,10,7,9,5,0,15,14,2,3,12}}\
|
|
|
,{{13,2,8,4,6,15,11,1,10,9,3,14,5,0,12,7},{1,15,13,8,10,3,7,4,12,5,6,11,0,14,9,2},{7,11,4,1,9,12,14,2,0,6,10,13,15,3,5,8},{2,1,14,7,4,10,8,13,15,12,9,0,3,5,6,11}}
|
|
|
};
|
|
|
int PC2c[56] = { 5,24,7,16,6,10,20,18,49,12,3,15,23,1,9,19,2,50,14,22,11,51,13,4,52,17,21,8,47,31,27,48,35,41,53,46,28,54,39,32,25,44,55,37,34,43,29,36,38,45,33,26,42,56,30,40 };
|
|
|
using namespace std;
|
|
|
class hexbin//16<31><36><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD>ת<EFBFBD><D7AA>Ϊ2<CEAA><32><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD>
|
|
|
private:
|
|
|
char a[26], count, i, j, e;
|
|
|
int bin[16][4];
|
|
|
public:
|
|
|
int c[64];
|
|
|
int* bina(int n)
|
|
|
{
|
|
|
count = 0;
|
|
|
cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>16<EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD>" << n << "<EFBFBD><EFBFBD>";
|
|
|
cin >> a;
|
|
|
for (i = 0; a[i] != '\0'; i++)//ÿ<><C3BF><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>Ӧ<EFBFBD><D3A6>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>λ<EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
switch (a[i])
|
|
|
{
|
|
|
case'0':
|
|
|
bin[i][0] = 0;
|
|
|
bin[i][1] = 0;
|
|
|
bin[i][2] = 0;
|
|
|
bin[i][3] = 0;
|
|
|
break;
|
|
|
case'1':
|
|
|
bin[i][0] = 0;
|
|
|
bin[i][1] = 0;
|
|
|
bin[i][2] = 0;
|
|
|
bin[i][3] = 1;
|
|
|
break;
|
|
|
case '2':
|
|
|
bin[i][0] = 0;
|
|
|
bin[i][1] = 0;
|
|
|
bin[i][2] = 1;
|
|
|
bin[i][3] = 0;
|
|
|
break;
|
|
|
case '3':
|
|
|
bin[i][0] = 0;
|
|
|
bin[i][1] = 0;
|
|
|
bin[i][2] = 1;
|
|
|
bin[i][3] = 1;
|
|
|
break;
|
|
|
case '4':
|
|
|
bin[i][0] = 0;
|
|
|
bin[i][1] = 1;
|
|
|
bin[i][2] = 0;
|
|
|
bin[i][3] = 0;
|
|
|
break;
|
|
|
case '5':
|
|
|
bin[i][0] = 0;
|
|
|
bin[i][1] = 1;
|
|
|
bin[i][2] = 0;
|
|
|
bin[i][3] = 1;
|
|
|
break;
|
|
|
case '6':
|
|
|
bin[i][0] = 0;
|
|
|
bin[i][1] = 1;
|
|
|
bin[i][2] = 1;
|
|
|
bin[i][3] = 0;
|
|
|
break;
|
|
|
case '7':
|
|
|
bin[i][0] = 0;
|
|
|
bin[i][1] = 1;
|
|
|
bin[i][2] = 1;
|
|
|
bin[i][3] = 1;
|
|
|
break;
|
|
|
case '8':
|
|
|
bin[i][0] = 1;
|
|
|
bin[i][1] = 0;
|
|
|
bin[i][2] = 0;
|
|
|
bin[i][3] = 0;
|
|
|
break;
|
|
|
case '9':
|
|
|
bin[i][0] = 1;
|
|
|
bin[i][1] = 0;
|
|
|
bin[i][2] = 0;
|
|
|
bin[i][3] = 1;
|
|
|
break;
|
|
|
case 'A':
|
|
|
bin[i][0] = 1;
|
|
|
bin[i][1] = 0;
|
|
|
bin[i][2] = 1;
|
|
|
bin[i][3] = 0;
|
|
|
break;
|
|
|
case 'B':
|
|
|
bin[i][0] = 1;
|
|
|
bin[i][1] = 0;
|
|
|
bin[i][2] = 1;
|
|
|
bin[i][3] = 1;
|
|
|
break;
|
|
|
case 'C':
|
|
|
bin[i][0] = 1;
|
|
|
bin[i][1] = 1;
|
|
|
bin[i][2] = 0;
|
|
|
bin[i][3] = 0;
|
|
|
break;
|
|
|
case 'D':
|
|
|
bin[i][0] = 1;
|
|
|
bin[i][1] = 1;
|
|
|
bin[i][2] = 0;
|
|
|
bin[i][3] = 1;
|
|
|
break;
|
|
|
case 'E':
|
|
|
bin[i][0] = 1;
|
|
|
bin[i][1] = 1;
|
|
|
bin[i][2] = 1;
|
|
|
bin[i][3] = 0;
|
|
|
break;
|
|
|
case 'F':
|
|
|
bin[i][0] = 1;
|
|
|
bin[i][1] = 1;
|
|
|
bin[i][2] = 1;
|
|
|
bin[i][3] = 1;
|
|
|
break;
|
|
|
default:
|
|
|
exit(-1);
|
|
|
}
|
|
|
count++;
|
|
|
}
|
|
|
e = 0;
|
|
|
for (i = 0; i < 16; i++) //<2F><><EFBFBD>ϳ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
for (j = 0; j < 4; j++)
|
|
|
{
|
|
|
c[e] = bin[i][j];
|
|
|
e++;
|
|
|
}
|
|
|
}
|
|
|
memset(bin, 0, sizeof(int) * 64);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
memset(a, 0, sizeof(char) * 26);
|
|
|
return c;
|
|
|
}
|
|
|
};
|
|
|
class kborn
|
|
|
{
|
|
|
private:
|
|
|
int i, j, dd, d[56], C[20][28], D[20][28], a, CD[56], c, b, ee, cc, e, bin[8], bina[8], Bbin[8], CDC[56];
|
|
|
public:
|
|
|
int ke[48];
|
|
|
int* ki(int qs, int n, int* CDC)
|
|
|
{
|
|
|
for (j = 0; j < 8; j++) //<2F><>ֵת<D6B5><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
cc = qs / 2;
|
|
|
bin[j] = qs % 2;
|
|
|
qs = cc;
|
|
|
if (qs == 0)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F3B6BCBB><EFBFBD>2<EFBFBD><32>1<EFBFBD><31><EFBFBD><EFBFBD>0
|
|
|
{
|
|
|
for (dd = j + 1; dd < 8; dd++) //<2F><>λ<EFBFBD><CEBB>0,<2C><>Ϊ8bit
|
|
|
{
|
|
|
bin[dd] = 0;
|
|
|
}
|
|
|
for (ee = 7; ee >= 0; ee--)
|
|
|
{
|
|
|
bina[7 - ee] = bin[ee];
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
for (j = 0; j < 8; j++)
|
|
|
{
|
|
|
Bbin[j] = bina[j];
|
|
|
}
|
|
|
CDC[0] = Bbin[0];
|
|
|
CDC[12] = Bbin[1];
|
|
|
CDC[21] = Bbin[2];
|
|
|
CDC[25] = Bbin[3];
|
|
|
CDC[29] = Bbin[4];
|
|
|
CDC[38] = Bbin[5];
|
|
|
CDC[41] = Bbin[6];
|
|
|
CDC[46] = Bbin[7];
|
|
|
for (i = 0; i < 28; i++)//<2F><><EFBFBD>ֳ<EFBFBD><D6B3><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF>28bit
|
|
|
{
|
|
|
C[0][i] = CDC[i];
|
|
|
}
|
|
|
for (i = 28; i < 56; i++)
|
|
|
{
|
|
|
D[0][i - 28] = CDC[i];
|
|
|
}
|
|
|
for (i = 1; i <= n; i++)//ѭ<><D1AD><EFBFBD><EFBFBD>λ
|
|
|
{
|
|
|
if (i == 1 || i == 2)//<2F><>һλ
|
|
|
{
|
|
|
a = C[i - 1][0];
|
|
|
c = D[i - 1][0];
|
|
|
for (j = 0; j < 27; j++)//<2F><>ѭ<EFBFBD><D1AD><EFBFBD><EFBFBD>λһλ
|
|
|
{
|
|
|
C[i][j] = C[i - 1][j + 1];
|
|
|
D[i][j] = D[i - 1][j + 1];
|
|
|
}
|
|
|
C[i][j] = a;
|
|
|
D[i][j] = c;
|
|
|
}
|
|
|
else//<2F><><EFBFBD><EFBFBD>λ
|
|
|
{
|
|
|
a = C[i - 1][0];
|
|
|
b = D[i - 1][0];
|
|
|
c = C[i - 1][1];
|
|
|
e = D[i - 1][1];
|
|
|
for (j = 0; j < 26; j++)//<2F><>ѭ<EFBFBD><D1AD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>λ
|
|
|
{
|
|
|
C[i][j] = C[i - 1][j + 2];
|
|
|
D[i][j] = D[i - 1][j + 2];
|
|
|
}
|
|
|
C[i][j] = a;
|
|
|
D[i][j] = b;
|
|
|
C[i][j + 1] = c;
|
|
|
D[i][j + 1] = e;
|
|
|
}
|
|
|
}
|
|
|
for (j = 0; j < 28; j++)//<2F><><EFBFBD><EFBFBD>28bit<69>ϲ<EFBFBD>Ϊһ<CEAA><D2BB>56<35><36><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
CD[j] = C[i - 1][j];
|
|
|
}
|
|
|
for (j = 28; j < 56; j++)
|
|
|
{
|
|
|
CD[j] = D[i - 1][j - 28];
|
|
|
}
|
|
|
for (j = 0; j < 48; j++)//<2F><><EFBFBD><EFBFBD>PC-2<>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ
|
|
|
{
|
|
|
ke[j] = CD[PCr[j] - 1];
|
|
|
}
|
|
|
return ke;
|
|
|
}
|
|
|
};
|
|
|
int main()
|
|
|
{
|
|
|
int i, j, e, b, qs, m[64], L[20][32], K[20][48], EA[48], R[20][32], N, a[12][64], m1[64], M[64], CDC[64], L0[12][32], L3[12][32], R3[12][32], EL3[12][48], ELc[6][48], Ec[6][8][6], R3c[6][32], L0c[6][32], R3L0[6][32];
|
|
|
int d, CSS, js, hang, lie, dd, ee, jj, CD[56], CDc[56], Cc[6][32], Ccf[6][8][4], bin[6], bina[6], CS, CS1, binar[6], bin1[4], bin2[4], BIN[4], binary[8][64][6], Bbin[6], count[8][64];
|
|
|
int cc, C[8], B[48], ges, duis, binbin[8][4], Pt[32], T[32];
|
|
|
hexbin hbin;
|
|
|
kborn kefe;
|
|
|
cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵĶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
|
|
cin >> duis;
|
|
|
ges = 2 * duis;
|
|
|
cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD>\n";
|
|
|
for (j = 0; j < ges; j++) //<2F><>16<31><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
int* c = hbin.bina(j + 1);
|
|
|
for (i = 0; i < 64; i++)
|
|
|
{
|
|
|
a[j][i] = c[i];
|
|
|
}
|
|
|
}
|
|
|
for (j = 0; j < ges; j++)
|
|
|
{
|
|
|
cout << "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" << j + 1 << "<EFBFBD>ǣ<EFBFBD>";
|
|
|
for (i = 0; i < 64; i++)
|
|
|
{
|
|
|
cout << a[j][i];
|
|
|
if ((i + 1) == 32)
|
|
|
cout << "\t";
|
|
|
}
|
|
|
}
|
|
|
for (i = 0; i < 64; i++)//<2F>ѵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8>Ƹ<EFBFBD>m1<6D><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
m1[i] = a[0][i];
|
|
|
}
|
|
|
for (j = 0; j < ges; j++) //<2F><><EFBFBD><EFBFBD>L0
|
|
|
{
|
|
|
for (i = 0; i < 32; i++)
|
|
|
{
|
|
|
L0[j][i] = a[j][i];
|
|
|
}
|
|
|
}
|
|
|
memset(a, 0, sizeof(int) * 640);
|
|
|
cout << endl;
|
|
|
cout << "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD>\n";
|
|
|
for (j = 0; j < ges; j++) //<2F><>16<31><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
int* c = hbin.bina(j + 1);
|
|
|
for (i = 0; i < 64; i++)
|
|
|
{
|
|
|
a[j][i] = c[i];
|
|
|
}
|
|
|
}
|
|
|
for (i = 0; i < 64; i++)//<2F>ѵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8>Ƹ<EFBFBD>m1<6D><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
M[i] = a[0][i];
|
|
|
}
|
|
|
for (j = 0; j < ges; j++) //<2F><><EFBFBD><EFBFBD>L3
|
|
|
{
|
|
|
cout << "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>L" << j + 1 << "<EFBFBD>ǣ<EFBFBD>";
|
|
|
for (i = 0; i < 32; i++)
|
|
|
{
|
|
|
L3[j][i] = a[j][i];
|
|
|
cout << L3[j][i];
|
|
|
}
|
|
|
cout << "\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>R" << j + 1 << "<EFBFBD>ǣ<EFBFBD>";
|
|
|
for (i = 32; i < 64; i++)
|
|
|
{
|
|
|
R3[j][i - 32] = a[j][i];
|
|
|
cout << R3[j][i - 32];
|
|
|
}
|
|
|
}
|
|
|
cout << endl;
|
|
|
for (i = 0; i < ges; i++) //<2F><><EFBFBD><EFBFBD>E<EFBFBD><45>չ<EFBFBD>û<EFBFBD>
|
|
|
{
|
|
|
cout << "\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>E<EFBFBD><EFBFBD>չ<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵER" << i + 1 << "<EFBFBD>ǣ<EFBFBD>";
|
|
|
for (j = 0; j < 48; j++)
|
|
|
{
|
|
|
EL3[i][j] = L3[i][E[j] - 1];
|
|
|
cout << EL3[i][j];
|
|
|
}
|
|
|
}
|
|
|
cout << endl;
|
|
|
for (i = 0; i < ges;) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
for (j = 0; j < 48; j++)
|
|
|
{
|
|
|
if (EL3[i][j] == EL3[i + 1][j])
|
|
|
ELc[i / 2][j] = 0;
|
|
|
else
|
|
|
ELc[i / 2][j] = 1;
|
|
|
}
|
|
|
i = i + 2;
|
|
|
}
|
|
|
for (i = 0; i < duis; i++)
|
|
|
{
|
|
|
cout << "\n<EFBFBD><EFBFBD>" << i + 1 << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD>";
|
|
|
for (j = 0; j < 48; j++)
|
|
|
{
|
|
|
cout << ELc[i][j];
|
|
|
}
|
|
|
}
|
|
|
for (i = 0; i < duis; i++) //<2F><><EFBFBD>飬ÿ<E9A3AC><C3BF>6bit
|
|
|
{
|
|
|
for (j = 0; j < 48;)
|
|
|
{
|
|
|
for (e = 0; e < 6; e++)
|
|
|
{
|
|
|
Ec[i][j / 6][e] = ELc[i][e + j];
|
|
|
}
|
|
|
j = j + 6;
|
|
|
}
|
|
|
}
|
|
|
for (i = 0; i < ges;) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>R3c
|
|
|
{
|
|
|
for (j = 0; j < 32; j++)
|
|
|
{
|
|
|
if (R3[i][j] == R3[i + 1][j])
|
|
|
R3c[i / 2][j] = 0;
|
|
|
else
|
|
|
R3c[i / 2][j] = 1;
|
|
|
}
|
|
|
i = i + 2;
|
|
|
}
|
|
|
for (i = 0; i < ges;) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>L0c
|
|
|
{
|
|
|
for (j = 0; j < 32; j++)
|
|
|
{
|
|
|
if (L0[i][j] == L0[i + 1][j])
|
|
|
L0c[i / 2][j] = 0;
|
|
|
else
|
|
|
L0c[i / 2][j] = 1;
|
|
|
}
|
|
|
i = i + 2;
|
|
|
}
|
|
|
for (i = 0; i < duis; i++) //<2F><><EFBFBD><EFBFBD>R3c<33><63>L0c<30>IJ<EFBFBD><C4B2><EFBFBD>
|
|
|
{
|
|
|
for (j = 0; j < 32; j++)
|
|
|
{
|
|
|
if (R3c[i][j] == L0c[i][j])
|
|
|
R3L0[i][j] = 0;
|
|
|
else
|
|
|
R3L0[i][j] = 1;
|
|
|
}
|
|
|
}
|
|
|
for (i = 0; i < duis; i++) //P<><50><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Cc
|
|
|
{
|
|
|
for (j = 0; j < 32; j++)
|
|
|
{
|
|
|
Cc[i][j] = R3L0[i][Pc[j] - 1];
|
|
|
}
|
|
|
}
|
|
|
cout << endl;
|
|
|
for (i = 0; i < duis; i++) //P<><50><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Cc
|
|
|
{
|
|
|
cout << "\n<EFBFBD><EFBFBD>" << i + 1 << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD>";
|
|
|
for (j = 0; j < 32; j++)
|
|
|
{
|
|
|
cout << Cc[i][j];
|
|
|
}
|
|
|
}
|
|
|
for (i = 0; i < duis; i++) //<2F><><EFBFBD>飬ÿ<E9A3AC><C3BF>4bit
|
|
|
{
|
|
|
for (j = 0; j < 32;)
|
|
|
{
|
|
|
for (e = 0; e < 4; e++)
|
|
|
{
|
|
|
Ccf[i][j / 4][e] = Cc[i][e + j];
|
|
|
}
|
|
|
j = j + 4;
|
|
|
}
|
|
|
}
|
|
|
cout << endl;
|
|
|
for (i = 0; i < duis; i++) //<2F>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
cout << "\n<EFBFBD><EFBFBD>" << i + 1 << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n";
|
|
|
cout << 1 << "\t" << 2 << "\t" << 3 << "\t" << 4 << "\t" << 5 << "\t" << 6 << "\t" << 7 << "\t" << 8 << "\n";
|
|
|
for (j = 0; j < 8; j++)
|
|
|
{
|
|
|
for (e = 0; e < 6; e++)
|
|
|
{
|
|
|
cout << Ec[i][j][e];
|
|
|
}
|
|
|
cout << "\t";
|
|
|
}
|
|
|
}
|
|
|
cout << endl;
|
|
|
for (i = 0; i < duis; i++) //<2F>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
cout << "\n<EFBFBD><EFBFBD>" << i + 1 << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n";
|
|
|
cout << 1 << "\t" << 2 << "\t" << 3 << "\t" << 4 << "\t" << 5 << "\t" << 6 << "\t" << 7 << "\t" << 8 << "\n";
|
|
|
for (j = 0; j < 8; j++)
|
|
|
{
|
|
|
for (e = 0; e < 4; e++)
|
|
|
{
|
|
|
cout << Ccf[i][j][e];
|
|
|
}
|
|
|
cout << "\t";
|
|
|
}
|
|
|
}
|
|
|
cout << endl;
|
|
|
memset(count, 0, sizeof(int) * 512);
|
|
|
for (dd = 0; dd < 8; dd++) //<2F><><EFBFBD>ΰ<EFBFBD><CEB0><EFBFBD>S<EFBFBD><53><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
for (i = 0; i < 64; i++)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>6bit<69><74>ѭ<EFBFBD><D1AD><EFBFBD><EFBFBD><EFBFBD>飬<EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD><EFBFBD>IN<49><4E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
CSS = i;
|
|
|
memset(bina, 0, sizeof(int) * 6);
|
|
|
memset(bin, 0, sizeof(int) * 6);
|
|
|
memset(Bbin, 0, sizeof(int) * 6);
|
|
|
for (j = 0; j < 6; j++) //<2F><>ֵת<D6B5><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
b = CSS / 2;
|
|
|
bin[j] = CSS % 2;
|
|
|
CSS = b;
|
|
|
if (CSS == 0)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F3B6BCBB><EFBFBD>2<EFBFBD><32>1<EFBFBD><31><EFBFBD><EFBFBD>0
|
|
|
{
|
|
|
for (d = j + 1; d < 6; d++) //<2F><>λ<EFBFBD><CEBB>0,<2C><>Ϊ6bit
|
|
|
{
|
|
|
bin[d] = 0;
|
|
|
}
|
|
|
for (e = 5; e >= 0; e--)
|
|
|
{
|
|
|
bina[5 - e] = bin[e];
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
for (j = 0; j < 6; j++)
|
|
|
{
|
|
|
Bbin[j] = bina[j];
|
|
|
}
|
|
|
memset(bin, 0, sizeof(int) * 6);
|
|
|
hang = bina[0] * 2 + bina[5];
|
|
|
lie = bina[1] * 8 + bina[2] * 4 + bina[3] * 2 + bina[4];
|
|
|
CS = S[dd][hang][lie];
|
|
|
memset(bina, 0, sizeof(int) * 6);
|
|
|
memset(bin, 0, sizeof(int) * 6);
|
|
|
memset(bin1, 0, sizeof(int) * 4);
|
|
|
for (j = 0; j < 4; j++) //<2F><>ֵת<D6B5><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
b = CS / 2;
|
|
|
bin[j] = CS % 2;
|
|
|
CS = b;
|
|
|
if (CS == 0)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F3B6BCBB><EFBFBD>2<EFBFBD><32>1<EFBFBD><31><EFBFBD><EFBFBD>0
|
|
|
{
|
|
|
for (d = j + 1; d < 4; d++) //<2F><>λ<EFBFBD><CEBB>0,<2C><>Ϊ4bit
|
|
|
{
|
|
|
bin[d] = 0;
|
|
|
}
|
|
|
for (e = 3; e >= 0; e--)
|
|
|
{
|
|
|
bina[3 - e] = bin[e];
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
for (j = 0; j < 4; j++)
|
|
|
{
|
|
|
bin1[j] = bina[j];
|
|
|
}
|
|
|
for (jj = 0; jj < duis; jj++)//<2F><><EFBFBD>鲻ͬ<E9B2BB>Ե<EFBFBD>ֵ
|
|
|
{
|
|
|
for (j = 0; j < 6; j++) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
if (Bbin[j] == Ec[jj][dd][j])
|
|
|
binar[j] = 0;
|
|
|
else
|
|
|
binar[j] = 1;
|
|
|
}
|
|
|
hang = binar[0] * 2 + binar[5];
|
|
|
lie = binar[1] * 8 + binar[2] * 4 + binar[3] * 2 + binar[4];
|
|
|
CS1 = S[dd][hang][lie];
|
|
|
memset(bin2, 0, sizeof(int) * 4);
|
|
|
memset(bin, 0, sizeof(int) * 6);
|
|
|
memset(bina, 0, sizeof(int) * 6);
|
|
|
for (j = 0; j < 4; j++) //<2F><>ֵת<D6B5><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
b = CS1 / 2;
|
|
|
bin[j] = CS1 % 2;
|
|
|
CS1 = b;
|
|
|
if (CS1 == 0)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F3B6BCBB><EFBFBD>2<EFBFBD><32>1<EFBFBD><31><EFBFBD><EFBFBD>0
|
|
|
{
|
|
|
for (d = j + 1; d < 4; d++) //<2F><>λ<EFBFBD><CEBB>0,<2C><>Ϊ4bit
|
|
|
{
|
|
|
bin[d] = 0;
|
|
|
}
|
|
|
for (e = 3; e >= 0; e--)
|
|
|
{
|
|
|
bina[3 - e] = bin[e];
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
for (j = 0; j < 4; j++)
|
|
|
{
|
|
|
bin2[j] = bina[j];
|
|
|
}
|
|
|
memset(BIN, 0, sizeof(int) * 4);
|
|
|
for (j = 0; j < 4; j++)
|
|
|
{
|
|
|
if (bin1[j] == bin2[j])
|
|
|
BIN[j] = 0;
|
|
|
else
|
|
|
BIN[j] = 1;
|
|
|
}
|
|
|
if ((BIN[0] == Ccf[jj][dd][0]) && (BIN[1] == Ccf[jj][dd][1]) && (BIN[2] == Ccf[jj][dd][2]) && (BIN[3] == Ccf[jj][dd][3]))//<2F>ж<EFBFBD><D0B6>Dz<EFBFBD><C7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IN<49><4E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
for (j = 0; j < 6; j++)
|
|
|
{
|
|
|
if (Bbin[j] == EL3[2 * jj][(dd * 6 + j)])//<2F><><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD>Ei<45><69><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>Կ
|
|
|
binary[dd][i][j] = 0;
|
|
|
else
|
|
|
binary[dd][i][j] = 1;
|
|
|
}
|
|
|
js = binary[dd][i][0] * 32 + binary[dd][i][1] * 16 + binary[dd][i][2] * 8 + binary[dd][i][3] * 4 + binary[dd][i][4] * 2 + binary[dd][i][5];
|
|
|
count[dd][js] = count[dd][js] + 1;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><D4BF><EFBFBD>ֵ<EFBFBD>λ<EFBFBD>úʹ<C3BA><CDB4><EFBFBD>
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
cout << endl;
|
|
|
for (dd = 0; dd < 8; dd++)
|
|
|
{
|
|
|
cout << "\n\nS" << dd + 1 << ":\n";
|
|
|
for (i = 0; i < 64; i++)
|
|
|
{
|
|
|
cout << count[dd][i];
|
|
|
if ((i + 1) % 16 == 0)
|
|
|
cout << "\n";
|
|
|
}
|
|
|
}
|
|
|
cout << endl << "<EFBFBD>õ<EFBFBD><EFBFBD>ĵ<EFBFBD>3<EFBFBD>ּ<EFBFBD><EFBFBD>ܵ<EFBFBD>48bit<EFBFBD><EFBFBD>ԿΪ<EFBFBD><EFBFBD>\n";
|
|
|
for (dd = 0; dd < 8; dd++)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD>
|
|
|
{
|
|
|
for (i = 0; i < 64; i++)
|
|
|
{
|
|
|
if (count[dd][i] == duis)
|
|
|
{
|
|
|
CSS = i;
|
|
|
for (j = 0; j < 6; j++) //<2F><>ֵת<D6B5><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
b = CSS / 2;
|
|
|
bin[j] = CSS % 2;
|
|
|
CSS = b;
|
|
|
if (CSS == 0)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F3B6BCBB><EFBFBD>2<EFBFBD><32>1<EFBFBD><31><EFBFBD><EFBFBD>0
|
|
|
{
|
|
|
for (d = j + 1; d < 6; d++) //<2F><>λ<EFBFBD><CEBB>0,<2C><>Ϊ6bit
|
|
|
{
|
|
|
bin[d] = 0;
|
|
|
}
|
|
|
for (e = 5; e >= 0; e--)
|
|
|
{
|
|
|
bina[5 - e] = bin[e];
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
for (e = 0; e < 6; e++)
|
|
|
{
|
|
|
cout << bina[e];
|
|
|
}
|
|
|
cout << "\t";
|
|
|
}
|
|
|
}
|
|
|
for (jj = 0; jj < 6; jj++)//<2F>ϲ<EFBFBD>Ϊһ<CEAA><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
CDc[(jj + 6 * dd)] = bina[jj];
|
|
|
}
|
|
|
}
|
|
|
for (i = 48; i < 56; i++)//<2F><>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>û<EFBFBD><C3BB>õ<EFBFBD>56bit<69><74><EFBFBD>м<EFBFBD><D0BC><EFBFBD>Կ
|
|
|
{
|
|
|
CDc[i] = 6;
|
|
|
}
|
|
|
for (i = 0; i < 56; i++)//PC2<43><32><EFBFBD>û<EFBFBD><C3BB>õ<EFBFBD><C3B5>м<EFBFBD>ֵ
|
|
|
{
|
|
|
CD[i] = CDc[PC2c[i] - 1];
|
|
|
}
|
|
|
dd = CD[27];
|
|
|
jj = CD[26];
|
|
|
e = CD[25];
|
|
|
CSS = CD[24];
|
|
|
for (i = 27; i >= 4; i--)
|
|
|
{
|
|
|
CD[i] = CD[i - 4];
|
|
|
}
|
|
|
CD[3] = dd;
|
|
|
CD[2] = jj;
|
|
|
CD[1] = e;
|
|
|
CD[0] = CSS;
|
|
|
dd = CD[55];
|
|
|
jj = CD[54];
|
|
|
e = CD[53];
|
|
|
CSS = CD[52];
|
|
|
for (i = 55; i >= 32; i--)
|
|
|
{
|
|
|
CD[i] = CD[i - 4];
|
|
|
}
|
|
|
CD[31] = dd;
|
|
|
CD[30] = jj;
|
|
|
CD[29] = e;
|
|
|
CD[28] = CSS;
|
|
|
cout << endl << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD>56bit<EFBFBD><EFBFBD>ԿΪ<EFBFBD><EFBFBD>\n";
|
|
|
for (i = 0; i < 56; i++)
|
|
|
{
|
|
|
cout << CD[i];
|
|
|
if ((i + 1) % 14 == 0)
|
|
|
cout << "\t";
|
|
|
}
|
|
|
for (i = 0; i < 56; i++)
|
|
|
{
|
|
|
CDC[i] = CD[i];
|
|
|
}
|
|
|
//<2F>ֳ<EFBFBD><D6B3><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF>32bit
|
|
|
for (i = 0; i < 32; i++)
|
|
|
{
|
|
|
L[0][i] = m1[i];
|
|
|
}
|
|
|
for (i = 32; i < 64; i++)
|
|
|
{
|
|
|
R[0][i - 32] = m1[i];
|
|
|
}
|
|
|
for (qs = 0; qs < 256; qs++)
|
|
|
{
|
|
|
for (N = 1; N <= 3; N++)
|
|
|
{
|
|
|
int* ke = kefe.ki(qs, N, CDC);//<2F><><EFBFBD><EFBFBD>48bit<69><74><EFBFBD><EFBFBD>Կ
|
|
|
for (i = 0; i < 48; i++)
|
|
|
{
|
|
|
K[N][i] = ke[i];
|
|
|
}
|
|
|
for (i = 0; i < 32; i++) //<2F><><EFBFBD><EFBFBD>һ<EFBFBD>ֵ<EFBFBD>L<EFBFBD><4C><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
L[N][i] = R[N - 1][i];
|
|
|
}
|
|
|
for (i = 0; i < 48; i++) //<2F><>32<33><32><EFBFBD><EFBFBD>R<EFBFBD><52>չ<EFBFBD><D5B9>48<34><38><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
EA[i] = R[N - 1][E[i] - 1];
|
|
|
}
|
|
|
for (i = 0; i < 48; i++) //EA<45><41>K<EFBFBD><4B><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
if (EA[i] == K[N][i])
|
|
|
B[i] = 0;
|
|
|
else
|
|
|
B[i] = 1;
|
|
|
}
|
|
|
for (i = 0; i < 48;) //<2F><><EFBFBD><EFBFBD>Ci<43><69>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ4bit<69><74>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD>պϲ<D5BA>Ϊһ<CEAA><D2BB>32bit
|
|
|
{
|
|
|
hang = B[i] * 2 + B[i + 5];
|
|
|
lie = B[i + 1] * 8 + B[i + 2] * 4 + B[i + 3] * 2 + B[i + 4];
|
|
|
C[i / 6] = S[i / 6][hang][lie];
|
|
|
i = i + 6;
|
|
|
}
|
|
|
for (j = 0; j < 8; j++)
|
|
|
{
|
|
|
e = C[j];
|
|
|
for (i = 0; i < 4; i++) //<2F><>ASCIIֵת<D6B5><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
b = e / 2;
|
|
|
binbin[j][i] = e % 2;
|
|
|
e = b;
|
|
|
if (e == 0)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F3B6BCBB><EFBFBD>2<EFBFBD><32>1<EFBFBD><31><EFBFBD><EFBFBD>0
|
|
|
{
|
|
|
for (cc = i + 1; cc < 4; cc++) //<2F><>λ<EFBFBD><CEBB>0,<2C><>Ϊ4bit
|
|
|
{
|
|
|
binbin[j][cc] = 0;
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
cc = 0;
|
|
|
for (j = 0; j < 8; j++) //32<33><32><EFBFBD>ؼ<EFBFBD>¼<EFBFBD><C2BC>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
for (i = 3; i >= 0; i--)
|
|
|
{
|
|
|
Pt[cc] = binbin[j][i];
|
|
|
cc++;
|
|
|
}
|
|
|
}
|
|
|
for (i = 0; i < 32; i++) //P<>û<EFBFBD><C3BB>˳<EFBFBD>f<EFBFBD><66><EFBFBD><EFBFBD>
|
|
|
{
|
|
|
T[i] = Pt[P[i] - 1];
|
|
|
}
|
|
|
for (i = 0; i < 32; i++) //L(i-1)<29><>f<EFBFBD><66><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>Ri
|
|
|
{
|
|
|
if (T[i] == L[N - 1][i])
|
|
|
R[N][i] = 0;
|
|
|
else
|
|
|
R[N][i] = 1;
|
|
|
}
|
|
|
}
|
|
|
if ((M[0] == L[3][0]) && (M[1] == L[3][1]) && (M[2] == L[3][2]) && (M[3] == L[3][3]) && (M[4] == L[3][4]) && (M[5] == L[3][5]) && (M[6] == L[3][6]) && (M[7] == L[3][7]) && (M[8] == L[3][8]) && (M[9] == L[3][9]) && (M[10] == L[3][10]) && (M[11] == L[3][11]) && (M[12] == L[3][12]) && (M[13] == L[3][13])\
|
|
|
&& (M[14] == L[3][14]) && (M[15] == L[3][15]) && (M[16] == L[3][16]) && (M[17] == L[3][17]) && (M[18] == L[3][18]) && (M[19] == L[3][19]) && (M[20] == L[3][20]) && (M[21] == L[3][21]) && (M[22] == L[3][22]) && (M[23] == L[3][23]) && (M[24] == L[3][24]) && (M[25] == L[3][25]) && (M[26] == L[3][26])\
|
|
|
&& (M[27] == L[3][27]) && (M[28] == L[3][28]) && (M[29] == L[3][29]) && (M[30] == L[3][30]) && (M[31] == L[3][31]) && (M[32] == R[3][0]) && (M[33] == R[3][1]) && (M[34] == R[3][2]) && (M[35] == R[3][3]) && (M[36] == R[3][4]) && (M[37] == R[3][5]) && (M[38] == R[3][6]) && (M[39] == R[3][7])\
|
|
|
&& (M[40] == R[3][8]) && (M[41] == R[3][9]) && (M[42] == R[3][10]) && (M[43] == R[3][11]) && (M[44] == R[3][12]) && (M[45] == R[3][13]) && (M[46] == R[3][14]) && (M[47] == R[3][15]) && (M[48] == R[3][16]) && (M[49] == R[3][17]) && (M[50] == R[3][18]) && (M[51] == R[3][19]) && (M[52] == R[3][20])\
|
|
|
&& (M[53] == R[3][21]) && (M[54] == R[3][22]) && (M[55] == R[3][23]) && (M[56] == R[3][24]) && (M[57] == R[3][25]) && (M[58] == R[3][26]) && (M[59] == R[3][27]) && (M[60] == R[3][28]) && (M[61] == R[3][29]) && (M[62] == R[3][30]) && (M[63] == R[3][31]))
|
|
|
break;
|
|
|
}
|
|
|
CDC[56] = 6;
|
|
|
CDC[57] = 6;
|
|
|
CDC[58] = 6;
|
|
|
CDC[59] = 6;
|
|
|
CDC[60] = 6;
|
|
|
CDC[61] = 6;
|
|
|
CDC[62] = 6;
|
|
|
CDC[63] = 6;
|
|
|
for (i = 0; i < 64; i++)
|
|
|
{
|
|
|
m[i] = CDC[PC1c[i] - 1];
|
|
|
}
|
|
|
cout << "\n\n\t\t<EFBFBD><EFBFBD><EFBFBD>ѵõ<EFBFBD>64bit<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԿΪ<EFBFBD><EFBFBD>\n";
|
|
|
for (i = 0; i < 64; i++)
|
|
|
{
|
|
|
cout << m[i];
|
|
|
if ((i + 1) % 4 == 0)
|
|
|
cout << "\t";
|
|
|
}
|
|
|
cout << "\n\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿһ<EFBFBD><EFBFBD><EFBFBD>ֽں<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD><EFBFBD>Ϳ<EFBFBD><EFBFBD>Եõ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><EFBFBD>\n";
|
|
|
system("PAUSE");
|
|
|
return 0;
|
|
|
}
|