ADD exercices week 2
This commit is contained in:
43
01-VeryEasy2/code.c
Normal file
43
01-VeryEasy2/code.c
Normal file
@@ -0,0 +1,43 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
char ENCSECRETPASSWORD[];
|
||||
|
||||
int main(int param_1, char* *param_2) {
|
||||
int8_t output_value;
|
||||
size_t input_length;
|
||||
char acStack_19 [13];
|
||||
|
||||
if (param_1 == 2) {
|
||||
input_length = strlen((char *)param_2[1]);
|
||||
if (input_length == 12) {
|
||||
for (uint8_t i = 0; i < 13; i++) {
|
||||
acStack_19[i] = ENCSECRETPASSWORD[i] + 'W'; // JSHGnQumN+sQ
|
||||
//f3 fc f1 f0 17 fa 1e 16 f7 d4 1c fa a9
|
||||
//
|
||||
|
||||
}
|
||||
for (uint8_t i = 0; i < 13; i++) {
|
||||
if (acStack_19[i] != *(char *)((long)i + param_2[1])) {
|
||||
fwrite("\nWrong password ! Try again...\n\n",1,32,stderr);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
fprintf(stderr,"\nCongratulations ! The right password is indeed %s :-)\n\n",param_2[1]);
|
||||
output_value = 35;
|
||||
}
|
||||
else {
|
||||
fwrite("\nWrong password ! Try again...\n\n",1,32,stderr);
|
||||
output_value = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
fwrite("\nMSE-SRE Challenge VE2 --- Enjoy !\n",1,35,stderr);
|
||||
fprintf(stderr,"\nUsage: %s <password>\n\n",*param_2);
|
||||
output_value = 1;
|
||||
}
|
||||
return output_value;
|
||||
}
|
||||
Reference in New Issue
Block a user