upd vigenere
This commit is contained in:
parent
f21294b03b
commit
80fc8763b0
BIN
main
BIN
main
Binary file not shown.
26
vigenere.c
26
vigenere.c
@ -2,8 +2,32 @@
|
||||
|
||||
int cryptVigenere(const char *key, const char *data, char *bufferDst) {
|
||||
int error = 0;
|
||||
char matrice[SIZE_MATRICE_VIGENERE][SIZE_MATRICE_VIGENERE];
|
||||
int i, j = 0;
|
||||
|
||||
printf("Vigenere\n");
|
||||
// Init the Vigenere matrice
|
||||
matriceVigenere(matrice);
|
||||
for (i = 0; i < SIZE_MATRICE_VIGENERE; i++) {
|
||||
for (j = 0; j < SIZE_MATRICE_VIGENERE; j++) {
|
||||
printf("%c ", matrice[i][j]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
void matriceVigenere(char matrice[][SIZE_MATRICE_VIGENERE]) {
|
||||
int i, j = 0;
|
||||
int k = 0;
|
||||
|
||||
for (i = 0; i < SIZE_MATRICE_VIGENERE; i++) {
|
||||
for (j = 0; j < SIZE_MATRICE_VIGENERE; j++) {
|
||||
//matrice[i][j] = 'A' + j;
|
||||
if (k == SIZE_MATRICE_VIGENERE + 1)
|
||||
matrice[i][j] = 'A' + j + k ;
|
||||
else
|
||||
matrice[i][j] = 'A' + j + k;
|
||||
}
|
||||
k++;
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,9 @@
|
||||
#define H_VIGENERE
|
||||
|
||||
#include "functions.h"
|
||||
#define SIZE_MATRICE_VIGENERE 26
|
||||
|
||||
int cryptVigenere(const char *key, const char *data, char *bufferDst);
|
||||
void matriceVigenere(char matrice[][SIZE_MATRICE_VIGENERE]);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user