91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 15KB
    文件類型: .c
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-05-13
  • 語言: C/C++
  • 標(biāo)簽: network??security??

資源簡介

這是網(wǎng)絡(luò)安全中,經(jīng)常使用也是堪稱經(jīng)典的DES加密算法的實(shí)現(xiàn)。這里主要用的是比較基礎(chǔ)的C語言來實(shí)現(xiàn)的,因?yàn)橐话汴P(guān)于系統(tǒng)層面的,用C語言開發(fā)比較多,故用該語言

資源截圖

代碼片段和文件信息

#include?
#include?
#include?

void?Des();//the?des?calculation
void?IPset(int?type);
void?iterate();
void?createSubkey(char*?CD?char*?subkey?int?time);
void?right_extend(char*right?char*?ex_right);
void?PC_set(char*?CD);
void?leftMove(char*?CD);
void?xor(char*right?char*subkey);
void?s_box(char*ex_right?char*right);
void?p_set(char*right);
void?print(char*?outout?int?length);

void?test(char?output[8][8]);

char?message[64];?//the?message
char?key[64];?//the?key
char?password[64];?//the?password?at?last
char?temp[8][8];

int?main()?{

while(1)?{

char?temp_key[56];
scanf(“%s“?&message);
scanf(“%s“?&temp_key);

/*make?the?64?bits?key*/
int?num?=?0;
for(int?i?=?0;?i? if((i+1)?%?8?==?0)?{
/*the?check?bit?is?set?to?zero*/
key[i]?=?‘0‘;
}
else?{
key[i]?=?temp_key[num];
num++;
}
}

printf(“before?the?des\n“);
printf(“message?is?:\n“);
print(message?64);
Des();
printf(“\nafter?the?des\n“);
printf(“password?is:\n“);
print(password?64);

break;
}
}

/*the?begining?of?the?des?calculation*/
void?Des()?{

for(int?i?=?0;?i? for(int?j?=?0;?j? temp[i][j]?=?message[i*8+j];

}

}

IPset(1);

iterate();
IPset(0);

for(int?i?=?0;?i? for(int?j?=?0;?j? password[i*8+j]?=?temp[i][j];
}
}
}

/*the?IP?set?depend?on?the?parameter
if?0?IPset
else?IPreset*/
void?IPset(int?type)?{

char?temp1[8][8];
for(int?i?=?0;?i? for?(int?j?=?0;?j? {
temp1[i][j]?=?temp[i][j];
}
}

temp[0][0]?=?type??temp1[7][1]:temp1[4][7];
temp[0][1]?=?type??temp1[6][1]:temp1[0][7];
temp[0][2]?=?type??temp1[5][1]:temp1[5][7];
temp[0][3]?=?type??temp1[4][1]:temp1[1][7];
temp[0][4]?=?type??temp1[3][1]:temp1[6][7];
temp[0][5]?=?type??temp1[2][1]:temp1[2][7];
temp[0][6]?=?type??temp1[1][1]:temp1[7][7];
temp[0][7]?=?type??temp1[0][1]:temp1[3][7];
temp[1][0]?=?type??temp1[7][3]:temp1[4][6];
temp[1][1]?=?type??temp1[6][3]:temp1[0][6];
temp[1][2]?=?type??temp1[5][3]:temp1[5][6];
temp[1][3]?=?type??temp1[4][3]:temp1[1][6];
temp[1][4]?=?type??temp1[3][3]:temp1[6][6];
temp[1][5]?=?type??temp1[2][3]:temp1[2][6];
temp[1][6]?=?type??temp1[1][3]:temp1[7][6];
temp[1][7]?=?type??temp1[0][3]:temp1[3][6];
temp[2][0]?=?type??temp1[7][5]:temp1[4][5];
temp[2][1]?=?type??temp1[6][5]:temp1[0][5];
temp[2][2]?=?type??temp1[5][5]:temp1[5][5];
temp[2][3]?=?type??temp1[4][5]:temp1[1][5];
temp[2][4]?=?type??temp1[3][5]:temp1[6][5];
temp[2][5]?=?type??temp1[2][5]:temp1[2][5];
temp[2][6]?=?type??temp1[1][5]:temp1[7][5];
temp[2][7]?=?type??temp1[0][5]:temp1[3][5];
temp[3][0]?=?type??temp1[7][7]:temp1[4][4];
temp[3][1]?=?type??temp1[6][7]:temp1[0][4];
temp[3][2]?=?type??temp1[5][7]:temp1[5][4];
temp[3][3]?=?type??temp1[4][7]:temp1[1][4];
temp[3][4]?=?type??temp1[3][7]:te

評論

共有 條評論