mirror of
https://github.com/LucasVbr/data-encryption-standard.git
synced 2026-05-13 17:12:10 +00:00
Ajout de junit
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -222,7 +222,7 @@ public class Des {
|
||||
|
||||
int[] resultat = new int[4];
|
||||
for (int i = 0; i < resultat.length; i++, coordonneeInt /= 10) {
|
||||
resultat[resultat.length-i-1] = coordonneeInt % 10;
|
||||
resultat[resultat.length - i - 1] = coordonneeInt % 10;
|
||||
}
|
||||
|
||||
return resultat;
|
||||
@@ -272,7 +272,7 @@ public class Des {
|
||||
this.genereCle(n);
|
||||
}
|
||||
|
||||
for (int i = 0; i < decoupe.length ; i++) {
|
||||
for (int i = 0; i < decoupe.length; i++) {
|
||||
permutation(PERM_INITIALE, decoupe[i]);
|
||||
|
||||
int[][] decoupe2 = decoupage(decoupe[i], 2);
|
||||
@@ -307,8 +307,8 @@ public class Des {
|
||||
System.arraycopy(bloc32[0], 0, dn1, 0, dn1.length);
|
||||
bloc32[0] = xor(bloc32[1], fonction_F(n, dn1));
|
||||
bloc32[1] = dn1;
|
||||
System.out.println("bloc32[0] :"+ Arrays.toString(bloc32[0]));
|
||||
System.out.println("bloc32[1] :"+ Arrays.toString(bloc32[1]));
|
||||
System.out.println("bloc32[0] :" + Arrays.toString(bloc32[0]));
|
||||
System.out.println("bloc32[1] :" + Arrays.toString(bloc32[1]));
|
||||
|
||||
}
|
||||
decoupe[i] = recollageBloc(bloc32);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package cryptography.test;
|
||||
package cryptography.temp;
|
||||
|
||||
import cryptography.Des;
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package cryptography;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class DesTest {
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
void tearDown() {
|
||||
}
|
||||
|
||||
@Test
|
||||
void stringToBits() {
|
||||
HashMap<String, int[]> attendu = new HashMap<>() {{
|
||||
put("Bonjour", new int[]{0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0});
|
||||
}};
|
||||
|
||||
for (Map.Entry<String, int[]> test : attendu.entrySet()) {
|
||||
assertArrayEquals(Des.stringToBits(test.getKey()), test.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void generePermutation() {
|
||||
}
|
||||
|
||||
@Test
|
||||
void bitsToString() {
|
||||
}
|
||||
|
||||
@Test
|
||||
void permutation() {
|
||||
}
|
||||
|
||||
@Test
|
||||
void invPermutation() {
|
||||
}
|
||||
|
||||
@Test
|
||||
void decoupage() {
|
||||
}
|
||||
|
||||
@Test
|
||||
void recollageBloc() {
|
||||
}
|
||||
|
||||
@Test
|
||||
void decaleGauche() {
|
||||
}
|
||||
|
||||
@Test
|
||||
void xor() {
|
||||
}
|
||||
|
||||
@Test
|
||||
void genereCle() {
|
||||
}
|
||||
|
||||
@Test
|
||||
void fonction_S() {
|
||||
}
|
||||
|
||||
@Test
|
||||
void fonction_F() {
|
||||
}
|
||||
|
||||
@Test
|
||||
void crypte() {
|
||||
}
|
||||
|
||||
@Test
|
||||
void decrypte() {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user