diff --git a/DEV 4.4/TP01/ex1.c b/DEV 4.4/TP01/ex1.c index 17733d9..e4ca9d7 100644 --- a/DEV 4.4/TP01/ex1.c +++ b/DEV 4.4/TP01/ex1.c @@ -35,6 +35,7 @@ int treatFile(FILE* input, FILE* output, uint32_t key[4], char method) { int n; uint32_t buffer[2]; + char eofbuffer; int m; //TODO: Padding management @@ -42,8 +43,16 @@ int treatFile(FILE* input, FILE* output, uint32_t key[4], char method) { switch (method) { case 'd': - while ((n = fread(buffer, 4, 2, input)) > 0) { + while (fread(buffer, 4, 2, input)) { decrypt(buffer, key); + + if (fread(&eofbuffer, 1, 1, input) == 0) { + char padding = (buffer[1] & 0xFF000000) >> 24; + + printf("%d\n", padding); + } else { + fseek(input, -1, SEEK_CUR); + } if (( m = fwrite(buffer, 4, 2, output)) != 2) { return 1; diff --git a/DEV 4.4/TP01/test b/DEV 4.4/TP01/test new file mode 100644 index 0000000..dd22fed Binary files /dev/null and b/DEV 4.4/TP01/test differ diff --git a/DEV 4.4/TP01/test.crypt b/DEV 4.4/TP01/test.crypt new file mode 100644 index 0000000..a9b0549 --- /dev/null +++ b/DEV 4.4/TP01/test.crypt @@ -0,0 +1,2 @@ +bmgÚá + „€.PÆV€Ç N \ No newline at end of file diff --git a/DEV 4.4/TP01/test.txt b/DEV 4.4/TP01/test.txt index 1656f92..c285f58 100644 --- a/DEV 4.4/TP01/test.txt +++ b/DEV 4.4/TP01/test.txt @@ -1 +1 @@ -abcdefgh \ No newline at end of file +The missile knows where it is at all times. \ No newline at end of file diff --git a/DEV-4.5/TP04/grille/.idea/gradle.xml b/DEV-4.5/TP04/grille/.idea/gradle.xml index 7394c74..ad32906 100644 --- a/DEV-4.5/TP04/grille/.idea/gradle.xml +++ b/DEV-4.5/TP04/grille/.idea/gradle.xml @@ -1,5 +1,6 @@ +