@@ -0,0 +1,2801 @@
+import java.util.Arrays;%0A%0Apublic class Chaocipher %7B%0A    private enum Mode %7B%0A        ENCRYPT,%0A        DECRYPT%0A    %7D%0A%0A    private static final String L_ALPHABET = %22HXUCZVAMDSLKPEFJRIGTWOBNYQ%22;%0A    private static final String R_ALPHABET = %22PTLNBQDEOYSFAVZKGJRIHWXUMC%22;%0A%0A    private static int indexOf(char%5B%5D a, char c) %7B%0A        for (int i = 0; i %3C a.length; ++i) %7B%0A            if (a%5Bi%5D == c) %7B%0A                return i;%0A            %7D%0A        %7D%0A        return -1;%0A    %7D%0A%0A    private static String exec(String text, Mode mode) %7B%0A        return exec(text, mode, false);%0A    %7D%0A%0A    private static String exec(String text, Mode mode, Boolean showSteps) %7B%0A        char%5B%5D left = L_ALPHABET.toCharArray();%0A        char%5B%5D right = R_ALPHABET.toCharArray();%0A        char%5B%5D eText = new char%5Btext.length()%5D;%0A        char%5B%5D temp = new char%5B26%5D;%0A%0A        for (int i = 0; i %3C text.length(); ++i) %7B%0A            if (showSteps) %7B%0A                System.out.printf(%22%25s  %25s%5Cn%22, new String(left), new String(right));%0A            %7D%0A            int index;%0A            if (mode == Mode.ENCRYPT) %7B%0A                index = indexOf(right, text.charAt(i));%0A                eText%5Bi%5D = left%5Bindex%5D;%0A            %7D else %7B%0A                index = indexOf(left, text.charAt(i));%0A                eText%5Bi%5D = right%5Bindex%5D;%0A            %7D%0A            if (i == text.length() - 1) %7B%0A                break;%0A            %7D%0A%0A            // permute left%0A%0A            if (26 - index %3E= 0) System.arraycopy(left, index, temp, 0, 26 - index);%0A            System.arraycopy(left, 0, temp, 26 - index, index);%0A            char store = temp%5B1%5D;%0A            System.arraycopy(temp, 2, temp, 1, 12);%0A            temp%5B13%5D = store;%0A            left = Arrays.copyOf(temp, temp.length);%0A%0A            // permute right%0A%0A            if (26 - index %3E= 0) System.arraycopy(right, index, temp, 0, 26 - index);%0A            System.arraycopy(right, 0, temp, 26 - index, index);%0A            store = temp%5B0%5D;%0A            System.arraycopy(temp, 1, temp, 0, 25);%0A            temp%5B25%5D = store;%0A            store = temp%5B2%5D;%0A            System.arraycopy(temp, 3, temp, 2, 11);%0A            temp%5B13%5D = store;%0A            right = Arrays.copyOf(temp, temp.length);%0A        %7D%0A%0A        return new String(eText);%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        String plainText = %22WELLDONEISBETTERTHANWELLSAID%22;%0A        System.out.printf(%22The original plaintext is : %25s%5Cn%22, plainText);%0A        System.out.println(%22%5CnThe left and right alphabets after each permutation during encryption are:%22);%0A        String cipherText = exec(plainText, Mode.ENCRYPT, true);%0A        System.out.printf(%22%5CnThe cipher text is : %25s%5Cn%22, cipherText);%0A        String plainText2 = exec(cipherText, Mode.DECRYPT);%0A        System.out.printf(%22%5CnThe recovered plaintext is : %25s%5Cn%22, plainText2);%0A    %7D%0A%7D%0A

Create Chaocipher.java