sch9_ctf_3/tasks/Возвращение зашифрованного файла/Исходники/encrypt_file.cpp

33 lines
621 B
C++

#include <stdio.h>
#include <stdlib.h>
const int maxsize = 33;
char line[maxsize+1];
char ans[maxsize+1];
FILE * file;
void copying() {
for (int i = 0; i < maxsize; ++i) {
ans[i] = line[i];
}
}
void encryption() {
for (int i = 0; i < maxsize; i+=1, ans[i] = (ans[i] + i) ^ '^'-'|'+'&') {
}
}
int main(int argc, char * argv[]) {
file = fopen("flag.txt", "r");
if (file == NULL)
printf("File does not exist!\n");
else {
fgets(line, maxsize+1, file);
copying();
encryption();
printf("%s\n", ans);
fclose(file);
}
return 0;
}