01: package org.bouncycastle.crypto.test;
02:
03: import org.bouncycastle.crypto.engines.CAST5Engine;
04: import org.bouncycastle.crypto.params.KeyParameter;
05: import org.bouncycastle.util.encoders.Hex;
06: import org.bouncycastle.util.test.SimpleTest;
07:
08: /**
09: * cast tester - vectors from http://www.ietf.org/rfc/rfc2144.txt
10: */
11: public class CAST5Test extends CipherTest {
12: static SimpleTest[] tests = {
13: new BlockCipherVectorTest(
14: 0,
15: new CAST5Engine(),
16: new KeyParameter(Hex
17: .decode("0123456712345678234567893456789A")),
18: "0123456789ABCDEF", "238B4FE5847E44B2"),
19: new BlockCipherVectorTest(
20: 0,
21: new CAST5Engine(),
22: new KeyParameter(Hex.decode("01234567123456782345")),
23: "0123456789ABCDEF", "EB6A711A2C02271B"),
24: new BlockCipherVectorTest(0, new CAST5Engine(),
25: new KeyParameter(Hex.decode("0123456712")),
26: "0123456789ABCDEF", "7Ac816d16E9B302E"), };
27:
28: CAST5Test() {
29: super (tests, new CAST5Engine(), new KeyParameter(new byte[16]));
30: }
31:
32: public String getName() {
33: return "CAST5";
34: }
35:
36: public static void main(String[] args) {
37: runTest(new CAST5Test());
38: }
39: }
|