Upload files to 'tasks/Возвращение зашифрованного файла/Исходники'
This commit is contained in:
parent
21ecc81c3a
commit
95aecb983d
4 changed files with 66 additions and 0 deletions
BIN
tasks/Возвращение зашифрованного файла/Исходники/decrypt
Normal file
BIN
tasks/Возвращение зашифрованного файла/Исходники/decrypt
Normal file
Binary file not shown.
|
@ -0,0 +1,32 @@
|
|||
#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 decryption() {
|
||||
for (int i = 0; i < maxsize; i+=1, ans[i] = (ans[i] ^ '^'-'|'+'&') - i) {
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
file = fopen("flag.enc", "r");
|
||||
if (file == NULL)
|
||||
printf("File does not exist!\n");
|
||||
else {
|
||||
fgets(line, maxsize+1, file);
|
||||
copying();
|
||||
decryption();
|
||||
printf("%s\n", ans);
|
||||
fclose(file);
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
#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;
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
ctf{0h_c0ngr4tz_y0u_g0t_th1s!}
|
||||
|
Loading…
Reference in a new issue