mirror of
https://github.com/LucasVbr/data-encryption-standard.git
synced 2026-05-13 17:12:10 +00:00
decoupage
This commit is contained in:
@@ -92,6 +92,24 @@ public class Des {
|
|||||||
System.arraycopy(newTab, 0, bloc, 0, newTab.length);
|
System.arraycopy(newTab, 0, bloc, 0, newTab.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int[][] decoupage(int[] bloc, int nbBlocs) {
|
||||||
|
|
||||||
|
if(bloc.length % nbBlocs == 0) {
|
||||||
|
int z = bloc.length / nbBlocs;
|
||||||
|
int [][] newTab = new int[nbBlocs][z];
|
||||||
|
int y = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < bloc.length ; i++) {
|
||||||
|
if (i % z == 0 && i > 0) {
|
||||||
|
y++;
|
||||||
|
}
|
||||||
|
newTab[y][i - y * z] = i;
|
||||||
|
}
|
||||||
|
return newTab;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private static int[] crypte(String message_clair) {
|
private static int[] crypte(String message_clair) {
|
||||||
// int[] msg_crypte = message_clair.byt
|
// int[] msg_crypte = message_clair.byt
|
||||||
return null; // Todo Bouchon
|
return null; // Todo Bouchon
|
||||||
|
|||||||
@@ -53,11 +53,18 @@ public class testDes {
|
|||||||
System.out.println(Arrays.equals(bloc, bloc2));
|
System.out.println(Arrays.equals(bloc, bloc2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void testDecoupage() {
|
||||||
|
|
||||||
|
System.out.println(Arrays.deepToString(Des.decoupage(new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19}, 4)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
// testStringToBits();
|
// testStringToBits();
|
||||||
// testBitsToString();
|
// testBitsToString();
|
||||||
// testGenerePermutation();
|
// testGenerePermutation();
|
||||||
// testPermuation();
|
// testPermuation();
|
||||||
testInvPermuation();
|
//testInvPermuation();
|
||||||
|
testDecoupage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user