01: package org.bouncycastle.crypto.test;
02:
03: import org.bouncycastle.crypto.engines.RC4Engine;
04: import org.bouncycastle.crypto.params.KeyParameter;
05: import org.bouncycastle.util.encoders.Hex;
06: import org.bouncycastle.util.test.SimpleTest;
07:
08: /**
09: * RC4 Test
10: */
11: public class RC4Test extends SimpleTest {
12: StreamCipherVectorTest[] tests = {
13: new StreamCipherVectorTest(0, new RC4Engine(),
14: new KeyParameter(Hex.decode("0123456789ABCDEF")),
15: "4e6f772069732074", "3afbb5c77938280d"),
16: new StreamCipherVectorTest(0, new RC4Engine(),
17: new KeyParameter(Hex.decode("0123456789ABCDEF")),
18: "68652074696d6520", "1cf1e29379266d59"),
19: new StreamCipherVectorTest(0, new RC4Engine(),
20: new KeyParameter(Hex.decode("0123456789ABCDEF")),
21: "666f7220616c6c20", "12fbb0c771276459") };
22:
23: public String getName() {
24: return "RC4";
25: }
26:
27: public void performTest() {
28: for (int i = 0; i != tests.length; i++) {
29: tests[i].performTest();
30: }
31: }
32:
33: public static void main(String[] args) {
34: runTest(new RC4Test());
35: }
36: }
|