#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
#define MAX 10000
#define key 4
void encryption(char m[]);
void decryption(char n[]);
int main()
{
char a[MAX],b[MAX];
printf("密钥可在源代码开头更改\n\n");
printf("请输入小写明文以加密");
gets_s(a);
a[strlen(a)] = '\0';
encryption(a);
printf("\n\n请输入大写明文以解密");
gets_s(b);
b[strlen(b)] = '\0';
decryption(b);
return 0;
}
void encryption(char m[])
{
int i, j, k,dis;
if ((strlen(m) % key) != 0)
dis = strlen(m) / key + 1;
else
dis = strlen(m) / key;
char n[MAX];
for (i = 0; i <= dis; i++)
{
char none;
n[4 * i] = m[i];
for (j = 4*i+1; j < 4*(i+1); j++)
{
k = j - 4 * i;
//n[j] = ' ';
if ((i+k * 14) < MAX)
n[j] = m[i + k*14];
else
n[j] = ' ';
}
}
n[strlen(m)] =
斯巴达木卷
最新推荐文章于 2023-08-12 10:31:09 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)