01: package org.bouncycastle.crypto.test;
02:
03: import org.bouncycastle.crypto.engines.XTEAEngine;
04: import org.bouncycastle.crypto.params.KeyParameter;
05: import org.bouncycastle.util.encoders.Hex;
06: import org.bouncycastle.util.test.SimpleTest;
07:
08: /**
09: * TEA tester - based on C implementation results from http://www.simonshepherd.supanet.com/tea.htm
10: */
11: public class XTEATest extends CipherTest {
12: static SimpleTest[] tests = {
13: new BlockCipherVectorTest(
14: 0,
15: new XTEAEngine(),
16: new KeyParameter(Hex
17: .decode("00000000000000000000000000000000")),
18: "0000000000000000", "dee9d4d8f7131ed9"),
19: new BlockCipherVectorTest(
20: 1,
21: new XTEAEngine(),
22: new KeyParameter(Hex
23: .decode("00000000000000000000000000000000")),
24: "0102030405060708", "065c1b8975c6a816"),
25: new BlockCipherVectorTest(
26: 2,
27: new XTEAEngine(),
28: new KeyParameter(Hex
29: .decode("0123456712345678234567893456789A")),
30: "0000000000000000", "1ff9a0261ac64264"),
31: new BlockCipherVectorTest(
32: 3,
33: new XTEAEngine(),
34: new KeyParameter(Hex
35: .decode("0123456712345678234567893456789A")),
36: "0102030405060708", "8c67155b2ef91ead"), };
37:
38: XTEATest() {
39: super (tests, new XTEAEngine(), new KeyParameter(new byte[16]));
40: }
41:
42: public String getName() {
43: return "XTEA";
44: }
45:
46: public static void main(String[] args) {
47: runTest(new XTEATest());
48: }
49: }
|