1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
using System;
using NUnit.Framework;
using Org.BouncyCastle.Crypto.Engines;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.Utilities.Encoders;
using Org.BouncyCastle.Utilities.Test;
namespace Org.BouncyCastle.Crypto.Tests
{
/**
* TEA tester - based on C implementation results from http://www.simonshepherd.supanet.com/tea.htm
*/
[TestFixture]
public class TeaTest
: CipherTest
{
private static readonly SimpleTest[] tests =
{
new BlockCipherVectorTest(0, new TeaEngine(),
new KeyParameter(Hex.Decode("00000000000000000000000000000000")),
"0000000000000000","41ea3a0a94baa940"),
new BlockCipherVectorTest(1, new TeaEngine(),
new KeyParameter(Hex.Decode("00000000000000000000000000000000")),
"0102030405060708", "6a2f9cf3fccf3c55"),
new BlockCipherVectorTest(2, new TeaEngine(),
new KeyParameter(Hex.Decode("0123456712345678234567893456789A")),
"0000000000000000", "34e943b0900f5dcb"),
new BlockCipherVectorTest(3, new TeaEngine(),
new KeyParameter(Hex.Decode("0123456712345678234567893456789A")),
"0102030405060708", "773dc179878a81c0"),
};
public TeaTest()
: base(tests, new TeaEngine(), new KeyParameter(new byte[16]))
{
}
public override string Name
{
get { return "TEA"; }
}
public static void MainOld(
string[] args)
{
RunTest(new TeaTest());
}
[Test]
public void TestFunction()
{
string resultText = Perform().ToString();
Assert.AreEqual(Name + ": Okay", resultText);
}
}
}
|