mirror of
https://github.com/LucasVbr/data-encryption-standard.git
synced 2026-07-09 14:57:48 +00:00
Test fonction_S
test de la fonction_S
This commit is contained in:
@@ -61,7 +61,7 @@ public class Des {
|
|||||||
24, 25, 26, 27, 28, 29,
|
24, 25, 26, 27, 28, 29,
|
||||||
28, 29, 30, 31, 32, 1,
|
28, 29, 30, 31, 32, 1,
|
||||||
};
|
};
|
||||||
private final ArrayList<int[][]> table_S;
|
public final ArrayList<int[][]> table_S;
|
||||||
public ArrayList<int[]> table_cles;
|
public ArrayList<int[]> table_cles;
|
||||||
private int[] masterKey = new int[64];
|
private int[] masterKey = new int[64];
|
||||||
|
|
||||||
|
|||||||
@@ -439,15 +439,17 @@ class DesTest {
|
|||||||
void fonction_S() {
|
void fonction_S() {
|
||||||
// TODO
|
// TODO
|
||||||
Des des = new Des();
|
Des des = new Des();
|
||||||
int[][] S = {
|
|
||||||
{14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7},
|
des.genereS(0);
|
||||||
{0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8},
|
int resultat_attendu_int = des.tableS.get(3).get(9);
|
||||||
{4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0},
|
|
||||||
{15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13}
|
int[] resultat_attendu = new int[4];
|
||||||
};
|
for (int i = 0; i < resultat_attendu.length; i++, resultat_attendu_int /= 10) {
|
||||||
|
resultat_attendu[resultat_attendu.length - i - 1] = resultat_attendu_int % 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// assertArrayEquals(<attendu>, des.fonction_S(...))
|
assertArrayEquals(resultat_attendu, des.fonction_S(new int[] {1,1,0,0,1,1}));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user