凱撒加密碼
⑴ 凱撒加密法 空格要表示么還是不用表示
不用表示。還有一些常用的方法是去了空格在凱撒,特別是多層加密的時候。
⑵ 凱撒演算法與DES加密演算法在性能上有何不同為什麼
數據加密標准DES
數據加密標准DES原是IBM公司於1972年研製成功的,目的在於保護公司的機密產品。美國商業部所屬國家標准局NBS也開始了一項計算機數據保護標準的發展規劃,這一舉措導致了DES的出台,並於1977年正式批准作為美國聯邦信息處理標准。該標准在國際上引起極大重視,ISO也將DES指定為數據加密標准。
DES是一個分組加密演算法,它所使用的密鑰長度為64位,由佔56位長度的實際密鑰和每個位元組的第8位的奇偶校驗碼這兩部分組成。它以64位為一組,將明文分成若干個分組,每次利用56位密鑰對64位的二進制明文分組進行數據加密,產生64位的密文。DES演算法的密鑰可以是任意的一個56位的數,且可在任意的時候改變。DES演算法整個加密處理過程需經16輪(round)的運算。每一輪運算
替代加密法
替代加密演算法是將明文中的每一個字元用另一個字元替換為密文中的一個字元。除接受者外,其他人不理解其間的替代。接受者對密文作反向替換後恢復成明文。
著名的凱撒加密演算法就是一種簡單的替代加密法,它是將明文中每一個字元用右移3位並以26個字元為模的替代(A由D替代,B由E替代,··…—,W由Z替代,X由A替代,Y由B替代,Z由C替代)。
⑶ 什麼是凱撒加密法
簡單的說,就是位移加密。
比如你的密碼是ABCDE
然後設置凱撒密碼的偏移量為3的話
那加密之後的密碼就是DEFGH
⑷ 凱撒加密法2w是什麼意思
根據蘇維托尼烏斯的記載,愷撒曾用此方法對重要的軍事信息進行加密: 如果需要保密,信中便用暗號,也即是改變字母順序,使局外人無法組成一個單詞。如果想要讀懂和理解它們的意思,得用第4個字母置換第一個字母,即以D代A,余此類推
⑸ 凱撒演算法是對稱加密演算法還是非對稱加密演算法為什麼
屬於對稱加密演算法
凱撒演算法屬於古典密碼,是對稱加密演算法最簡單的形式
⑹ 網路安全凱撒密碼的計算方法。
凱撒密碼關鍵的是密匙,密匙也就是一個數字,比如說密匙是1,那對英文單詞book這個單詞加密,結果就是相應的每個字母在字母表中的序號減去1,比如b在英文單詞里排第二位,那加密後就是a,o加密後就是n,依此類推,book加密後就是annj,解密時每個字母的順序號加1,所對應的字母就是密文。
⑺ 求凱撒加密法(c語言)
#include<stdio.h>
#include<conio.h> char encrypt(char ch,int n)/*加密函數,把字元向右循環移位n*/
{
while(ch>=A&&ch<=Z)
{
return (A+(ch-A+n)%26);
}
while(ch>=a&&ch<=z)
{
return (a+(ch-a+n)%26);
}
return ch;
}void menu()/*菜單,1.加密,2.解密,3.暴力破解,密碼只能是數字*/
{
clrscr();
printf("\n===============================================================================");
printf("\n1.Encrypt the file");
printf("\n2.Decrypt the file");
printf("\n3.Force decrypt file");
printf("\n4.Quit\n");
printf("===============================================================================\n");
printf("Please select a item:");
return;
}void logo()/*顯示版權信息*/
{
printf("\nZhensoft Encryption [Version:1.0.0]");
printf("\nCopyright (C) 2004 Zhensoft Corp.\n");
printf("\n http://www.zhensoft.com\n");
return;
}
main()
{
int i,n;
char ch0,ch1;
FILE *in,*out;
char infile[20],outfile[20];textbackground(BLACK);
textcolor(LIGHTGREEN);
clrscr();logo();
sleep(3);/*等待3秒*/menu();
ch0=getch();while(ch0!=4)
{
if(ch0==1)
{
clrscr();
printf("\nPlease input the infile:");
scanf("%s",infile);/*輸入需要加密的文件名*/ if((in=fopen(infile,"r"))==NULL)
{
printf("Can not open the infile!\n");
printf("Press any key to exit!\n");
getch();
exit(0);
} printf("Please input the key:");
scanf("%d",&n);/*輸入加密密碼*/ printf("Please input the outfile:");
scanf("%s",outfile);/*輸入加密後文件的文件名*/ if((out=fopen(outfile,"w"))==NULL)
{
printf("Can not open the outfile!\n");
printf("Press any key to exit!\n");
fclose(in);
getch();
exit(0);
} while(!feof(in))/*加密*/
{
fputc(encrypt(fgetc(in),n),out);
} printf("\nEncrypt is over!\n");
fclose(in);
fclose(out);
sleep(1);
} if(ch0==2)
{
clrscr();
printf("\nPlease input the infile:");
scanf("%s",infile);/*輸入需要解密的文件名*/ if((in=fopen(infile,"r"))==NULL)
{
printf("Can not open the infile!\n");
printf("Press any key to exit!\n");
getch();
exit(0);
} printf("Please input the key:");
scanf("%d",&n);/*輸入解密密碼(可以為加密時候的密碼)*/ n=26-n; printf("Please input the outfile:");
scanf("%s",outfile);/*輸入解密後文件的文件名*/ if((out=fopen(outfile,"w"))==NULL)
{
printf("Can not open the outfile!\n");
printf("Press any key to exit!\n");
fclose(in);
getch();
exit(0);
} while(!feof(in))
{
fputc(encrypt(fgetc(in),n),out);
}
printf("\nDecrypt is over!\n");
fclose(in);
fclose(out);
sleep(1);
} if(ch0==3)
{
clrscr();
printf("\nPlease input the infile:");
scanf("%s",infile);/*輸入需要解密的文件名*/ if((in=fopen(infile,"r"))==NULL)
{
printf("Can not open the infile!\n");
printf("Press any key to exit!\n");
getch();
exit(0);
} printf("Please input the outfile:");
scanf("%s",outfile);/*輸入解密後文件的文件名*/ if((out=fopen(outfile,"w"))==NULL)
{
printf("Can not open the outfile!\n");
printf("Press any key to exit!\n");
fclose(in);
getch();
exit(0);
} for(i=1;i<=25;i++)/*暴力破解過程,在察看信息正確後,可以按Q或者q退出*/
{
rewind(in);
rewind(out);
clrscr();
printf("===============================================================================\n");
printf("The outfile is:\n");
printf("===============================================================================\n");
while(!feof(in))
{
ch1=encrypt(fgetc(in),26-i);
putch(ch1);
fputc(ch1,out);
}
printf("\n===============================================================================\n");
printf("The current key is: %d \n",i);/*顯示當前破解所用密碼*/
printf("Press Q to quit and other key to continue......\n");
printf("===============================================================================\n");
ch1=getch();
if(ch1==q||ch1==Q)/*按Q或者q時退出*/
{
clrscr();
logo();
printf("\nGood Bye!\n");
fclose(in);
fclose(out);
sleep(3);
exit(0);
}
} printf("\nForce decrypt is over!\n");
fclose(in);
fclose(out);
sleep(1);
}
menu();
ch0=getch();
}
clrscr();
logo();
printf("\nGood Bye!\n");
sleep(3);
}
⑻ 凱撒演算法是屬於對稱加密演算法嗎
最早的公鑰演算法是有凱撒大帝發明的,所以也叫凱撒演算法,凱撒演算法是很簡單的演算法,它的學名是「單表替換演算法」。就如同這個演算法名稱的字面意思一樣,他把一個字母替換成另一個字母,比如:把 "a" 替換成 "b", "c" 替換成 "d" 以此類推, 直到把 "z" 替換成 "a",這里每個字母都備下一個字母替換,所以密鑰就是1(如果密鑰是2則把 "a" 替換成 "c")。
它不是對稱加密演算法!
⑼ 凱撒密碼的演算法c語言的怎麼實現啊
凱撒密碼是一種非常古老的加密方法,相傳當年凱撒大地行軍打仗時為了保證自己的命令不被敵軍知道,就使用這種特殊的方法進行通信,以確保信息傳遞的安全。他的原理很簡單,說到底就是字母於字母之間的替換。下面讓我們看一個簡單的例子:「」用凱撒密碼法加密後字元串變為「edlgx」,它的原理是什麼呢?把「」中的每一個字母按字母表順序向後移3位,所得的結果就是剛才我們所看到的密文。
#include <stdio.h>
main()
{
char M[100];
char C[100];
int K=3,i;
printf("請輸入明文M(注意不要輸入空白串)\n");
gets(M);
for(i=0;M[i]!='\0';i++)
C[i]=(M[i]-'a'+K)%26+'a';
C[i]='\0';
printf("結果是:\n%s\n",C);
}