#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct sysuser
{
char username[20];
char password[8];
};
void encrypt(char *pwd);
int main()
{
FILE *fp;
int i;
struct sysuser su;
if ((fp = fopen("*f12-2.txt", "w")) == NULL)
{
printf("File open error!\n");
exit(0);
}
for (i = 1; i <= 5; i++)
{
printf("Enter %d th sysuser(name password):", i);
scanf("%s%s", su.username, su.password);
encrypt(su.password);
fprintf(fp, "%s%s\n", su.username, su.password);
}
if (fclose(fp))
{
printf("Can not close the file!\n");
exit(0);
}
return 0;
}
void encrypt(char *pwd)
{
int i;
for (i = 0; i < strlen(pwd); i++)
pwd[i] = pwd[i] ^ 15;
}
文件加密算法研究示例
最新推荐文章于 2024-06-25 02:40:23 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)