C语言!加加密凯撒算法(只加密)的密源码媒体来源码错误源代码
凯撒密码的原理是字母与字母之间的替换。例如个字母都向后移动K位。源码查找java方法源码若K等于2,加加密则A用C代替,密源码B用D代替,源码以此类推。加加密#include <stdio.h>#include <conio.h>
int main(){
int key;
char mingma,密源码mima;
printf("\nPlease input the character:");
scanf("%c",&mingma); //输入明码
printf("\nPlease input the key:");
scanf("%d",&key); //输入秘钥
if((mingma>='A')&&(mingma<='Z'))
mima='A'+(mingma-'A'+key)%; //大写字母移位
else if((mingma>='a')&&(mingma<='z'))
mima='a'+(mingma-'a'+key)%; //小写字母移位
printf("\n The output is:%c",mima); //输出密码
printf("\nFinished!\n");
getch();
return 0;
}
维吉利亚加密算法 求C或C++源代码 !!源码急
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
void encrypt(char *m,加加密vc 管理 源码下载 char *k, char *c) //加密算法
{
int i = 0,j=0;
while(m[i] != '\0')
{
if(m[i] >= 'a' && m[i] <= 'z')
{
c[i] = (m[i] - 'a' + k[i%4] - 'a') % + 'a';
i++;
}
else
{
c[i] = (m[i] - 'A' + k[i%4] - 'A') % + 'A';
i++;
}
}
c[i] = '\0';
}
void decrypt(char *m, char *k, char *c) //解密算法
{
int i = 0,j=0;
while(c[i] != '\0')
{
if(c[i] >= 'a' && c[i] <= 'z')
{
m[i] = (c[i] - k[i%4] + ) % + 'a'; //注意此处
i++;
}
}
m[i] = '\0';
}
void main()
{
int ii = 1, jj,j;
char mm[];
char kk[];
printf("enter the k's contest:");
for(j=0;kk[j-1]!='#';j++)
{
kk[j]=getchar();
}
char cc[];
while(ii)
{
printf("0:Exit 1 : Encrypt 2 : Decrypt\n");
printf("input the number:\n");
scanf("%d",&jj);
switch (jj)
{
case 0:
break;
case 1 : printf("input the original text:\n");
scanf("%s", mm);
encrypt(mm, kk, cc);
printf("%s\n", cc);
break;
case 2 : printf("input the cryptograph:\n");
scanf("%s", cc);
decrypt(mm, kk, cc);
printf("%s\n", mm);
break;
default : break;
}
}
}
你再调试下,有点小错
密源码keilç¼åçCç¨åºå¯ä»¥å å¯åï¼
密源码ä½ çææ没æ说çå¾æç½ï¼ä½æå¯ä»¥æä¾å 个æ¹æ¡ï¼
密源码1 å¦æåªæ¯ä¸æ³è®©äººçå°cæºç ï¼é£ä¹ä½ ç´æ¥ç»å«äººHEXæ件就好äºï¼è½ç¶HEXæ件å¯ä»¥åæ±ç¼ï¼ä½æ¯åæ±ç¼åºæ¥çä¸è¥¿ï¼ä¸æ¯é£ä¹å®¹æçæç
密源码2 对HEXæ件å å¯ï¼è¿åæ±ç¼é½ä¸å¯ä»¥äºï¼è¿æ ·äººå®¶å³ä½¿æ¿å°ä½ çHEXæ件ï¼ä¹ä¸è½é便ä¸è½½å°ä»»æçè¯çï¼å¦æè¿æ ·çè¯ï¼ä½ å°±å¾è¦ä¹æä¾å«äººä¸ä¸ªä¸ä½æºè§£å¯ç¨åºï¼è¦ä¹æ解å¯ç¨åºæ¾å°bootloaderç¨åºéé¢ççï¼æ»ä¹è¦æ解å¯æ¹æ¡
密源码2024-12-23 06:41
2024-12-23 06:12
2024-12-23 05:11
2024-12-23 04:52
2024-12-23 04:20