01: package org.bouncycastle.crypto.test;
02:
03: import org.bouncycastle.crypto.engines.TEAEngine;
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 TEATest extends CipherTest {
12: static SimpleTest[] tests = {
13: new BlockCipherVectorTest(
14: 0,
15: new TEAEngine(),
16: new KeyParameter(Hex
17: .decode("00000000000000000000000000000000")),
18: "0000000000000000", "41ea3a0a94baa940"),
19: new BlockCipherVectorTest(
20: 1,
21: new TEAEngine(),
22: new KeyParameter(Hex
23: .decode("00000000000000000000000000000000")),
24: "0102030405060708", "6a2f9cf3fccf3c55"),
25: new BlockCipherVectorTest(
26: 2,
27: new TEAEngine(),
28: new KeyParameter(Hex
29: .decode("0123456712345678234567893456789A")),
30: "0000000000000000", "34e943b0900f5dcb"),
31: new BlockCipherVectorTest(
32: 3,
33: new TEAEngine(),
34: new KeyParameter(Hex
35: .decode("0123456712345678234567893456789A")),
36: "0102030405060708", "773dc179878a81c0"), };
37:
38: TEATest() {
39: super (tests, new TEAEngine(), new KeyParameter(new byte[16]));
40: }
41:
42: public String getName() {
43: return "TEA";
44: }
45:
46: public static void main(String[] args) {
47: runTest(new TEATest());
48: }
49: }
|