private static void initBlockCipherEngines() { blockCipherEngines.put("MARS", MarsEngine.class); blockCipherEngines.put("AES", AESEngine.class); blockCipherEngines.put("Blowfish", BlowfishEngine.class); blockCipherEngines.put("Camellia", CamelliaEngine.class); blockCipherEngines.put("CAST5", CAST5Engine.class); blockCipherEngines.put("CAST6", CAST6Engine.class); blockCipherEngines.put("DESede", DESedeEngine.class); blockCipherEngines.put("DES", DESEngine.class); blockCipherEngines.put("GOST28147", GOST28147Engine.class); blockCipherEngines.put("IDEA", IDEAEngine.class); blockCipherEngines.put("Noekeon", NoekeonEngine.class); blockCipherEngines.put("RC2", RC2Engine.class); blockCipherEngines.put("RC5", RC532Engine.class); blockCipherEngines.put("RC6", RC6Engine.class); blockCipherEngines.put("SEED", SEEDEngine.class); blockCipherEngines.put("Serpent", SerpentEngine.class); blockCipherEngines.put("Shacal2", Shacal2Engine.class); blockCipherEngines.put("Skipjack", SkipjackEngine.class); blockCipherEngines.put("SM4", SM4Engine.class); blockCipherEngines.put("TEA", TEAEngine.class); blockCipherEngines.put("Twofish", TwofishEngine.class); blockCipherEngines.put("XTEA", XTEAEngine.class); blockCipherEngines.put("Threefish", ThreefishEngine.class); }
private void iteratedTest(int index, byte[] key, byte[] plain, byte[] cipher, byte[] cipher100, byte[] cipher1000) { BlockCipher engine = new Shacal2Engine(); engine.init(true, new KeyParameter(key)); byte[] buf = new byte[plain.length]; System.arraycopy(plain, 0, buf, 0, plain.length); engine.processBlock(buf, 0, buf, 0); if (!Arrays.areEqual(cipher, buf)) { fail(index + " single count failed"); } for (int i = 1; i != 100; i++) { engine.processBlock(buf, 0, buf, 0); } if (!Arrays.areEqual(cipher100, buf)) { fail(index + " 100 count failed"); } for (int i = 100; i != 1000; i++) { engine.processBlock(buf, 0, buf, 0); } if (!Arrays.areEqual(cipher1000, buf)) { fail(index + " 1000 count failed"); } }
public ECB() { super(new BlockCipherProvider() { public BlockCipher get() { return new Shacal2Engine(); } }); }
Shacal2Test() { super(tests, new Shacal2Engine(), new KeyParameter(new byte[16])); }
public CBC() { super(new CBCBlockCipher(new Shacal2Engine()), 256);//block size }
public CMAC() { super(new CMac(new Shacal2Engine())); }