使用C语言对数据进行加密,具体方法如下:#include void main(){int a[5];int num, temp, encripy; int i;do{printf("Please input the number:");sc
使用C语言对数据进行加密,具体方法如下:
#include void main()
{
int a[5];
int num, temp, encripy;
int i;
do
{
printf("Please input the number:");
scanf("%d",&num);
if(!(num/10000 !=0 && num/100000==0))
printf("Data error!\n");
}while(!(num/10000 !=0 && num/100000==0));
a[0] = num/10000%10;
a[1] = num/1000%10;
a[2] = num/100%10;
a[3] = num/10%10;
a[4] = num%10;
for(i = 0; i < 5; ++i)
a[i] = (a[i] + 8)%10;
temp = a[0];
a[0] = a[3];
a[3] = temp;
temp = a[1];
a[1] = a[2];
a[2] = temp;
encripy = a[0]*10000 + a[1]*1000 + a[2]*100 + a[3]*10 + a[4];
printf("\nThe scourse number: %d\n", num);
printf("\nEncripy the number: %d\n\n", encripy);
}
--结束END--
本文标题: 如何用c语言进行数据加密
本文链接: https://www.lsjlt.com/news/113424.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0