01: package org.bouncycastle.crypto.test;
02:
03: import org.bouncycastle.crypto.engines.RC6Engine;
04: import org.bouncycastle.crypto.params.KeyParameter;
05: import org.bouncycastle.util.encoders.Hex;
06: import org.bouncycastle.util.test.SimpleTest;
07:
08: /**
09: * RC6 Test - test vectors from AES Submitted RSA Reference implementation.
10: * ftp://ftp.funet.fi/pub/crypt/cryptography/symmetric/aes/rc6-unix-refc.tar
11: */
12: public class RC6Test extends CipherTest {
13: static SimpleTest[] tests = {
14: new BlockCipherVectorTest(
15: 0,
16: new RC6Engine(),
17: new KeyParameter(Hex
18: .decode("00000000000000000000000000000000")),
19: "80000000000000000000000000000000",
20: "f71f65e7b80c0c6966fee607984b5cdf"),
21: new BlockCipherVectorTest(
22: 1,
23: new RC6Engine(),
24: new KeyParameter(
25: Hex
26: .decode("000000000000000000000000000000008000000000000000")),
27: "00000000000000000000000000000000",
28: "dd04c176440bbc6686c90aee775bd368"),
29: new BlockCipherVectorTest(
30: 2,
31: new RC6Engine(),
32: new KeyParameter(
33: Hex
34: .decode("000000000000000000000000000000000000001000000000")),
35: "00000000000000000000000000000000",
36: "937fe02d20fcb72f0f57201012b88ba4"),
37: new BlockCipherVectorTest(
38: 3,
39: new RC6Engine(),
40: new KeyParameter(Hex
41: .decode("00000001000000000000000000000000")),
42: "00000000000000000000000000000000",
43: "8a380594d7396453771a1dfbe2914c8e"),
44: new BlockCipherVectorTest(
45: 4,
46: new RC6Engine(),
47: new KeyParameter(
48: Hex
49: .decode("1000000000000000000000000000000000000000000000000000000000000000")),
50: "00000000000000000000000000000000",
51: "11395d4bfe4c8258979ee2bf2d24dff4"),
52: new BlockCipherVectorTest(
53: 5,
54: new RC6Engine(),
55: new KeyParameter(
56: Hex
57: .decode("0000000000000000000000000000000000080000000000000000000000000000")),
58: "00000000000000000000000000000000",
59: "3d6f7e99f6512553bb983e8f75672b97") };
60:
61: RC6Test() {
62: super (tests, new RC6Engine(), new KeyParameter(new byte[32]));
63: }
64:
65: public String getName() {
66: return "RC6";
67: }
68:
69: public static void main(String[] args) {
70: runTest(new RC6Test());
71: }
72: }
|