Author: j16sdiz
Date: 2008-05-13 16:10:32 +0000 (Tue, 13 May 2008)
New Revision: 19912

Modified:
   trunk/freenet/src/freenet/crypt/ciphers/Rijndael.java
Log:
No Monte Carlo test for Rijndael


Modified: trunk/freenet/src/freenet/crypt/ciphers/Rijndael.java
===================================================================
--- trunk/freenet/src/freenet/crypt/ciphers/Rijndael.java       2008-05-13 
12:11:24 UTC (rev 19911)
+++ trunk/freenet/src/freenet/crypt/ciphers/Rijndael.java       2008-05-13 
16:10:32 UTC (rev 19912)
@@ -102,65 +102,6 @@
                        throw new IllegalArgumentException();
                Rijndael_Algorithm.blockDecrypt(block, result, 0, sessionKey, 
blocksize/8);
        }
-
-       public static void main(String[] args) throws 
UnsupportedCipherException {
-               // Perform the Monte Carlo test
-
-               System.out.println("KEYSIZE=128\n");
-               monteCarlo(128);
-               System.out.println("=========================\n");
-               System.out.println("KEYSIZE=192\n");
-               monteCarlo(192);
-               System.out.println("=========================\n");
-               System.out.println("KEYSIZE=256\n");
-               monteCarlo(256);
-       }
-
-       static void monteCarlo(int keySize) throws UnsupportedCipherException {
-               Rijndael ctx=new Rijndael(keySize);
-               int kb=keySize/8;
-               byte[] P=new byte[16], C=new byte[16], 
-               CL=new byte[16], KEY=new byte[kb];
-
-               for (int i=0; i<400; i++) {
-                       System.out.println("I="+i);
-                       System.out.println("KEY="+HexUtil.bytesToHex(KEY,0,kb));
-
-                       System.out.println("PT="+HexUtil.bytesToHex(P,0,16));
-
-                       ctx.initialize(KEY);
-                       for (int j=0; j<10000; j++) {
-                               System.arraycopy(C, 0, CL, 0, C.length);
-                               ctx.encipher(P, C);
-                               System.arraycopy(C, 0, P, 0, P.length);
-                       }
-                       System.out.println("CT="+HexUtil.bytesToHex(C,0,16));
-
-
-                       for (int x=0; x<kb; x++) {
-                               if (keySize==192)
-                                       if (x<8)
-                                               KEY[x]^=CL[8+x];
-                                       else 
-                                               KEY[x]^=C[x-8];
-                               else if (keySize==256)
-                                       if (x<16)
-                                               KEY[x]^=CL[x];
-                                       else 
-                                               KEY[x]^=C[x-16];
-                               else KEY[x]^=C[x];
-                       }
-
-                       if (keySize==192) 
-                               for (int x=0; x<8; x++) 
-                                       KEY[x+16]^=CL[x+8];
-                       else if (keySize==256) 
-                               for (int x=0; x<16; x++) 
-                                       KEY[x+16]^=CL[x];
-
-                       System.out.println();
-               }
-       }
 }




Reply via email to