|
|
|
[求助]手动脱UPX 0.89.6 - 1.02 / 1.05 - 1.24 壳遇到的问题,有自己操作详细过程
呃……你说的好专业,不太明白……自校验……我后来用upx 2.03能够脱下壳来了,脱完之后再查一遍是VC++ 7.0的,但是我不满足与结果,我想知道怎么来手动啦~呵呵~ |
|
[求助]手动脱UPX 0.89.6 - 1.02 / 1.05 - 1.24 壳遇到的问题,有自己操作详细过程
源文件有啊,只不过是个链接,我网速太慢,传不上来,直接附加了一个链接,在文章的最后一句话有……不知道你说的源文件是不是指的程序。 |
|
[原创]密码学学习之DES
给些建议,学习下。 |
|
|
|
[原创]密码学学习之DES(申请邀请)
以上是我通过密码学的学习编写的程序,实现了那个以上的需求,需求全部都是按照你搜索的那个网页的需求来实现的,这样实现起来比较有目的性,既有加密也有解密,并且能够实现分析,从而不用单纯的实现算法,因为通过分析这个算法能够对算法有更深的了解。 我的解释行么? |
|
[原创]密码学学习之DES(申请邀请)
以上是我通过密码学的学习编写的程序,实现了那个以上的需求,需求全部都是按照你搜索的那个网页的需求来实现的,这样实现起来比较有目的性,既有加密也有解密,并且能够实现分析,从而不用单纯的实现算法,因为通过分析这个算法能够对算法有更深的了解。 我的解释行么? |
|
[原创]密码学学习之DES(申请邀请)
最后是main.c文件 --------------------------main.c------------------------------------ #include "des.h" extern int subkey[16][48]; int main() { int choise; char ch; printf("\t\t\t #DES encrypt# \n"); Des_SetKey();//get the peer key while (1) { printf("\t\t1.Use ECB MODE to encrypt a bmp picture.\n"); printf("\t\t2.Use CBC MODE to encrypt a bmp picture.\n"); printf("\t\t3.Snow Slip Analyse.\n"); printf("\t\t4.Integrality Analyse.\n"); printf("\t\t5.Differences Analyse.\n"); printf("\t\t6.Other S-Box Analyse.\n"); printf("\t\t0.Quit.\n"); printf("Your choice:"); for (;!isdigit(ch=getchar());); choise = ch -'0'; switch (choise) { case 1: EBC(); break; case 2: CBC(); break; case 3: SnowSlip(); break; case 4: Integrality(); break; case 5: Differential(); break; case 6: Other_S_Box_Analyse(); break; default: return 0; } } return 0; } ----------------------------华丽的分割线----------------------------- 以上就是我学习的DES,还请各位高手指教,希望能够申请到邀请码。 |
|
[原创]密码学学习之DES(申请邀请)
-----------------------------picture.c---------------------------------- #include "des.h" #define NAME_SIZE 64 extern int S_Box[8][4][16]; extern int S_Box_standard[8][4][16]; void EBC(void) { memcpy(S_Box,S_Box_standard,8*4*16*sizeof(int)); FILE * infp, * outfp; int b[64],i,n; unsigned char a[9],c[9],filename[NAME_SIZE+12],temp[8]; memset(temp,'\0',8); a[8]='\0'; c[8]='\0'; Set_FileName(&infp,&outfp,1,filename); Skip_Head(infp,outfp); while (!feof(infp)) { n=fread(a,1,8,infp); if (n<8) { for (i=n;i<8;i++) { a[i]=(char)(rand()%255); } } byte_to_bit(64,a,b); DES(b,1); bit_to_byte(64,c,b);/******bit -> byte*****/ if (n==8) fwrite(c,1,8,outfp); else { int j=0; for (i=n;i<8;i++) temp[j++] = c[i]; fwrite(c,1,n,outfp); } } printf("\nEncrypt complete!\nThe picture's name is out_ebc%s\n\n",filename); fclose(infp); fclose(outfp); Decrpty_EBC(temp); } void Decrpty_EBC(const char * temp) { FILE * infp, * outfp; int b[64],i,n; char a[9],c[9],filename[NAME_SIZE+12]; a[8]='\0'; c[8]='\0'; Set_FileName(&infp,&outfp,2,filename); Skip_Head(infp,outfp); while (!feof(infp)) { n=fread(a,1,8,infp); if (n<8) { int j=0; for (i=n;i<8;i++) a[i]=temp[j++]; } byte_to_bit(64,a,b); DES(b,2); bit_to_byte(64,c,b);/******bit -> byte*****/ if (n==8) fwrite(c,1,8,outfp); else fwrite(c,1,n,outfp); } printf("\nDecrypt complete!\nThe picture's name is decrpty_%s\n\n",filename); fclose(infp); fclose(outfp); } void CBC(void) { memcpy(S_Box,S_Box_standard,8*4*16*sizeof(int)); FILE * infp, * outfp; int b[64],d[64],i,n; unsigned char a[9],c[9],filename[NAME_SIZE+15],temp[8],IV[9]={"kerberos"}; memset(temp,'\0',8); a[8]='\0'; c[8]='\0'; Set_FileName(&infp,&outfp,3,filename); Skip_Head(infp,outfp); byte_to_bit(64,IV,d); while (!feof(infp)) { n=fread(a,1,8,infp); if (n<8) { for (i=n;i<8;i++) { a[i]=(char)(rand()%255); } } byte_to_bit(64,a,b); Xor_func(b,d,64); DES(b,1); bit_to_byte(64,c,b);/******bit -> byte*****/ byte_to_bit(64,c,d); if (n==8) fwrite(c,1,8,outfp); else { int j=0; for (i=n;i<8;i++) temp[j++] = c[i]; fwrite(c,1,n,outfp); } } printf("\nEncrypt complete!\nThe picture's name is out_cbc%s\n\n",filename); fclose(infp); fclose(outfp); Decrpty_CBC(temp); } void Decrpty_CBC(const char * temp) { FILE * infp, * outfp; int b[64],d[64],i,n; char a[9],c[9],filename[NAME_SIZE+12],IV[9]={"kerberos"}; a[8]='\0'; c[8]='\0'; Set_FileName(&infp,&outfp,4,filename); Skip_Head(infp,outfp); byte_to_bit(64,IV,d); while (!feof(infp)) { n=fread(a,1,8,infp); if (n<8) { int j=0; for (i=n;i<8;i++) a[i]=temp[j++]; } byte_to_bit(64,a,b); DES(b,2); Xor_func(b,d,64); bit_to_byte(64,c,b);/******bit -> byte*****/ byte_to_bit(64,a,d); if (n==8) fwrite(c,1,8,outfp); else fwrite(c,1,n,outfp); } printf("\nDecrypt complete!\nThe picture's name is decrpty_%s\n\n",filename); fclose(infp); fclose(outfp); } void Set_FileName(FILE ** in,FILE ** out,int mode,char * name) { char filein[NAME_SIZE],fileout[NAME_SIZE+15]; memset(filein,'\0',NAME_SIZE); memset(fileout,'\0',NAME_SIZE+15); if (mode == 1 || mode == 3) printf("Please input your picture to encrypt <XXX.bmp>: "); else printf("Please input your picture to decrypt <XXX.bmp>: "); while (gets(filein)) if (strlen(filein)) break; if (mode == 1) strcpy(fileout,"out_ebc"); else if (mode == 3) strcpy(fileout,"out_cbc"); else strcpy(fileout,"decrypt_"); strncat(fileout,filein,NAME_SIZE); strcpy(name,filein); if (!(*in=fopen(filein,"rb")) || !(*out=fopen(fileout,"wb"))) { printf("Can't open file!\n"); exit(1); } } void Skip_Head(FILE * in,FILE * out) { char buf[140]; fread(buf,140*sizeof(char),1,in); fwrite(buf,140*sizeof(char),1,out); } -----------------------------华丽的分割线----------------------------- -----------------------------analyse.c------------------------------- #include "des.h" #define TEXT_NUM 256 const int getbit=0x01; extern const int IP_Table[64]; extern int subkey[16][48]; static int randbox[8][4][16]; extern int S_Box[8][4][16]; static int linebox[8][4][16]; const static int From16_Prime[32]={3, 5, 7, 9, 11, 13, 15, 17, 23, 19, 25, 21, 33, 31, 27, 29, 39, 37, 41, 35, 43 , 49, 45, 47, 53, 57, 51, 55, 63, 65, 61, 59}; void Print_File(const int *p,FILE * fp) { int i; for (i=0;i<64;i++) { fprintf(fp,"%d",p[i]); if (!((i+1)%8)) fputc(' ',fp); } fputc('\r',fp); fputc('\n',fp); } void Snow_Plaintext(int *p1,int *p2) { int i,anybit=rand()%64; for (i=0;i<64;i++) { p1[i] = rand()%2; p2[i] = p1[i]; } p2[anybit] = p1[anybit] ^ getbit; } void SnowSlip(void) { int p1[64],p2[64]; FILE *fp; int i; int *L1i = &p1[0],*R1i = &p1[32],*L2i = &p2[0],*R2i = &p2[32],tmp1[64],tmp2[64]; memcpy(tmp1,p1,64*sizeof(int)); Transform(p1,tmp1,IP_Table,64);//permute plaintext first memcpy(tmp2,p2,64*sizeof(int)); Transform(p2,tmp2,IP_Table,64);//permute plaintext first if ((fp=fopen("Snowslip_Analyse.txt","wb"))==NULL) { printf("Can't open the Snowslip_Analyse.txt\r\n"); exit(1); } Snow_Plaintext(p1,p2); fprintf(fp,"\t\t\t###Snowslip_Analyse###\r\n"); fprintf(fp,"The plaintexts :\r\n"); Print_File(p1,fp); Print_File(p2,fp); for (i=0;i<16;i++) { if (i==0) fprintf(fp,"\r\nThis is the 1st round.\r\n"); else if (i==1) fprintf(fp,"\r\nThis is the 2nd round.\r\n"); else if (i==2) fprintf(fp,"\r\nThis is the 3rd round.\r\n"); else fprintf(fp,"\r\nThis is the %dth round.\r\n",i+1); Every_Round_Des(L1i,R1i,subkey,i); Print_File(p1,fp); Every_Round_Des(L2i,R2i,subkey,i); Print_File(p2,fp); int j,count=0; for (j=0;j<64;j++) if (p1[j] != p2[j]) count++; fprintf(fp,"%d bits different.\r\n",count); } printf("Snow Slip Analyse Complete!\nThe result is in the Snowslip_Analyse.txt\n\n"); fclose(fp); } void Integrality_Plaintext(int * p,const int anybit,const int bit) { int i; for (i=0;i<64;i++) p[i]=rand()%2; p[anybit]=bit; } void Integrality(void) { int anybit=rand()%64,bit=rand()%2,plain[64]; int i,count[64]; memset(count,0,64*sizeof(int)); for (i=0;i<TEXT_NUM;i++) { Integrality_Plaintext(plain,anybit,bit); DES(plain,1); int j; for (j=0;j<64;j++) if (plain[j]) count[j]++; } printf("Integrality Analyse Complete!\nThe result is in the Integrality_Analyse.txt.\n\n"); FILE * fp=fopen("Integrality_Analyse.txt","wb"); fprintf(fp,"Every message is the same as %d in %d.\r\n",bit,anybit); fprintf(fp,"Every bit is 1 of the frequency.\r\n"); fprintf(fp,"bit\tfrequency\r\n"); for (i=0;i<64;i++) fprintf(fp,"%d\t%.3f\r\n",i+1,(float)count[i]/TEXT_NUM); fclose(fp); } int bit_to_ten(int * in,int n) { int i,j,num=0; for (j=0,i=n-1;i>=0;j++,i--) { num += (getbit<<j)*in[i]; } return num; } void Differential(void) { int count[8][64][16]; memset(count,0,8*64*16*sizeof(int)); int i, j, k; FILE * fp=fopen("Differential.txt","wb"); fprintf(fp,"The Differential analysis of every S-box.\r\n"); for (i=0;i<8;i++) { for (j=0;j<64;j++) { int in1[6]={0},in2[6]={0},out1[4]={0},out2[4]={0}; for (k=0;k<64;k++) { ten_to_bit(in1,j,6);//j-->bit(in1) S_single(in1,out1,i); ten_to_bit(in2,k,6);//k-->bit(in2) S_single(in2,out2,i); Xor_func(in1,in2,6);//in1 ^ in2 --> in1 Xor_func(out1,out2,4);//out1 ^ out2 --> out1 count[i][bit_to_ten(in1,6)][bit_to_ten(out1,4)]++; } } } for (i=0;i<8;i++) { fprintf(fp,"\r\nS-box %d Differential Table:\r\n\t",i+1); for (k=0;k<16;k++) fprintf(fp,"%d\t",k); fprintf(fp,"max-number\tlocation"); for (j=0;j<64;j++) { int max=-1,local; fprintf(fp,"\r\n%d\t",j); for (k=0;k<16;k++) { if (max<count[i][j][k]) { max=count[i][j][k]; local=k; } fprintf(fp,"%d\t",count[i][j][k]); } fprintf(fp,"%d\t\t%d",max,local); } } printf("\nDifferential Analyse Comlpete!\nThe result is in the Differential.txt.\n\n"); fclose(fp); } void Rand_S_Box(void) { int i,j,k,flag[16],temp; for (i=0;i<8;i++) { for (j=0;j<4;j++) { memset(flag,0,16); for (k=0;k<16;k++) { for (temp=rand()%16;flag[temp];temp=rand()%16); randbox[i][j][k]=temp; } } } memcpy(S_Box,randbox,8*4*16*sizeof(int)); } void Line_S_Box(void) { int i,j,k,index,a=17; for (i=0;i<8;i++) { for (j=0;j<4;j++) { int flag[16]={0}; for (k=0;k<16;a++,k++) { for (index=(a*From16_Prime[i*4+j])%16;flag[index];a++,index=(a*From16_Prime[i*4+j])%16); flag[index]=1; linebox[i][j][k]=index; } } } memcpy(S_Box,linebox,8*4*16*sizeof(int)); } void Control(void) { char ch; int choise; while (1) { printf("\t\t1.Snow Slip Analyse.\n"); printf("\t\t2.Integrality Analyse.\n"); printf("\t\t3.Differences Analyse.\n"); printf("\t\t0.Quit.\n"); printf("Your choice:"); for (;!isdigit(ch=getchar());); choise = ch -'0'; switch (choise) { case 1: SnowSlip(); break; case 2: Integrality(); break; case 3: Differential(); break; default: return; } } } void Other_S_Box_Analyse(void) { char ch; int choise; while (1) { printf("\t\t1.Use S-Line-Box\n\t\t2.Use S-Rand-Box\n\t\t0.Quit.\n"); printf("Your choice:"); for (;!isdigit(ch=getchar());); choise = ch -'0'; switch (choise) { case 1: Line_S_Box(); Control(); break; case 2: Rand_S_Box(); Control(); break; default : return; } } } -----------------------------华丽的分割线----------------------------- |
|
[原创]密码学学习之DES(申请邀请)
-------------------------------des_key.c-------------------------- #include <string.h> #include <stdio.h> #include <stdlib.h> #include <math.h> #include "des.h" extern int S_Box[8][4][16]; extern int S_Box_standard[8][4][16]; unsigned char key[9]; unsigned int peerkey[64]; unsigned int first_round_key[56];//由peerkey的初始置换得到的key const int getbit;//得到字节的末位 int subkey[16][48]; /*************从0开始计数的话,以后用表都要减1*****************/ // permuted choice table (key) const int PC1_Table[56] = { 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4 }; // permuted choice key (table) const int PC2_Table[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 }; // number left rotations of pc1 const int LOOP_Table[16] = { 1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1 }; void bit_to_byte(int n, unsigned char * out,int * in) { int i; unsigned char temp[9]; memset(temp,'\0',9); for (i=0;i<n;i++) temp[i/8] |= in[i]<<(i%8); memcpy(out,temp,9); } void byte_to_bit(int n,unsigned char * in,int * out) { int i; unsigned char temp[9]; memset(temp,'\0',9); memcpy(temp,in,9); for (i=0;i<n;temp[i++/8]>>=1) out[i] = temp[i/8]&getbit; } void GetPeerKey(void) { printf("Please input your 8 bytes key\n"); gets(key); byte_to_bit(64,key,peerkey);//change byte into bit } //change byte into bit //change the 64-bit key into 56-bit void Transform(int * out,int * in,const int * table,int n) { int i,j; for (i=0,j=0;i<n;i++) out[j++]=in[table[i]-1]; } //Rotate funtion void RotateL(int *In, int len, int loop) { static int Tmp[64]; memcpy(Tmp, In, loop);//Store the first (loop) bits to Tmp memcpy(In, In+loop, len-loop);//Copy the end of the (len-loop) bits to the front of In memcpy(In+len-loop, Tmp, loop);//Move the Stored (loop) bits to the end of Nes In } //get every round key void Des_SetKey(void) { static int *KL = &first_round_key[0], *KR = &first_round_key[28]; int i; GetPeerKey(); Transform(first_round_key,peerkey,PC1_Table,56); for (i=0; i<16; i++) { RotateL(KL, 28, LOOP_Table[i]); //Left shift circle RotateL(KR, 28, LOOP_Table[i]); //Left shift circle Transform(subkey[i], first_round_key, PC2_Table, 48);//PC2 Transform } } -------------------------------华丽的分割线-------------------------- -------------------------------feistel_net.c------------------------- #include <string.h> #include <stdio.h> #include <stdlib.h> #include "des.h" extern char key[9]; extern const int getbit; extern int subkey[16][48]; int S_Box[8][4][16]; // initial permutation IP const int IP_Table[64] = { 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8, 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3, 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7 }; // final permutation IP^-1 const int IPR_Table[64] = { 40, 8, 48, 16, 56, 24, 64, 32, 39, 7, 47, 15, 55, 23, 63, 31, 38, 6, 46, 14, 54, 22, 62, 30, 37, 5, 45, 13, 53, 21, 61, 29, 36, 4, 44, 12, 52, 20, 60, 28, 35, 3, 43, 11, 51, 19, 59, 27, 34, 2, 42, 10, 50, 18, 58, 26, 33, 1, 41, 9, 49, 17, 57, 25 }; // expansion operation matrix const int E_Table[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 }; // 32-bit permutation function P used on the output of the S-boxes const int P_Table[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 }; // The (in)famous S-boxes int S_Box_standard[8][4][16] = { // S1 {{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}}, // S2 {{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}}, // S3 {{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}}, // S4 {{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}}, // S5 {{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}}, // S6 {{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}}, // S7 {{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}}, // S8 {{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}} }; void Xor_func(int *out,const int *in,int n) { int i; for (i=0;i<n;i++) out[i] ^= in[i]; } void ten_to_bit(int *out,const int s,int n) { int i,j; for (j=0,i=n-1;i>=0;i--,j++) out[i] = (s >> j) & getbit; } void S_single(const int *in,int *out,int i) { int j=(in[0]<<1)+in[5]; int k=(in[1]<<3)+(in[2]<<2)+(in[3]<<1)+in[4]; ten_to_bit(out,S_Box[i][j][k],4); } void S_func(const int *in,int *out) { int i; for (i=0;i<8;i++,in+=6,out+=4) S_single(in,out,i); } void Feistel_Net(const int keyi[48],int in[32]) { static int extend[48],temp[32]; Transform(extend,in,E_Table,48); Xor_func(extend,keyi,48); S_func(extend,in);//change 48-bit extend into 32-bit in. memcpy(temp,in,32*sizeof(int)); Transform(in,temp,P_Table,32);//permute } void Every_Round_Des(int Li[32],int Ri[32], int keyi[16][48],int i) { int temp[32]; memcpy(temp,Ri,32*sizeof(int)); Feistel_Net(keyi[i],Ri); Xor_func(Ri,Li,32); memcpy(Li,temp,32*sizeof(int)); } void Exchange(int * left,int * right) { int tmp[32]; memcpy(tmp,left,32*sizeof(int)); memcpy(left,right,32*sizeof(int)); memcpy(right,tmp,32*sizeof(int)); } void DES(int text[64],int mod) { int i,*Li = &text[0],*Ri = &text[32],tmp[64]; memcpy(tmp,text,64*sizeof(int)); Transform(text,tmp,IP_Table,64);//permute plaintext first if (mod == 1) { for (i=0;i<ROUND;i++)//16 rounds Every_Round_Des(Li,Ri,subkey,i); } else { for (i=15;i>=0;i--)//16 rounds Every_Round_Des(Li,Ri,subkey,i); } Exchange(Li,Ri);//exchange Li and Ri memcpy(tmp,text,64*sizeof(int)); Transform(text,tmp,IPR_Table,64);//permute text at last } -------------------------------华丽的分割线-------------------------- |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值