01: package org.bouncycastle.crypto.test;
02:
03: import org.bouncycastle.crypto.Digest;
04: import org.bouncycastle.crypto.digests.GOST3411Digest;
05:
06: public class GOST3411DigestTest extends DigestTest {
07: private static final String[] messages = { "",
08: "This is message, length=32 bytes",
09: "Suppose the original message has length = 50 bytes",
10: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" };
11:
12: // If S-box = D-A (see: digest/GOST3411Digest.java; function: E(byte[] in, byte[] key); string: CipherParameters param = new GOST28147Parameters(key,"D-A");)
13: private static final String[] digests = {
14: "981e5f3ca30c841487830f84fb433e13ac1101569b9c13584ac483234cd656c0",
15: "2cefc2f7b7bdc514e18ea57fa74ff357e7fa17d652c75f69cb1be7893ede48eb",
16: "c3730c5cbccacf915ac292676f21e8bd4ef75331d9405e5f1a61dc3130a65011",
17: "73b70a39497de53a6e08c67b6d4db853540f03e9389299d9b0156ef7e85d0f61" };
18:
19: // private static final String[] digests =
20: // {
21: // "ce85b99cc46752fffee35cab9a7b0278abb4c2d2055cff685af4912c49490f8d"; //If S-box = D-Test (see: digest/GOST3411Digest.java; function:E(byte[] in, byte[] key); string: CipherParameters param = new GOST28147Parameters(key,"D-Test");)
22: // "b1c466d37519b82e8319819ff32595e047a28cb6f83eff1c6916a815a637fffa"; //If S-box = D-Test (see: digest/GOST3411Digest.java; function:E(byte[] in, byte[] key); string: CipherParameters param = new GOST28147Parameters(key,"D-Test");)
23: // "471aba57a60a770d3a76130635c1fbea4ef14de51f78b4ae57dd893b62f55208"; //If S-box = D-Test (see: digest/GOST3411Digest.java; function:E(byte[] in, byte[] key); string: CipherParameters param = new GOST28147Parameters(key,"D-Test");)
24: // "95c1af627c356496d80274330b2cff6a10c67b5f597087202f94d06d2338cf8e"; //If S-box = D-Test (see: digest/GOST3411Digest.java; function:E(byte[] in, byte[] key); string: CipherParameters param = new GOST28147Parameters(key,"D-Test");)
25: // };
26:
27: // 1 million 'a'
28: static private String million_a_digest = "8693287aa62f9478f7cb312ec0866b6c4e4a0f11160441e8f4ffcd2715dd554f";
29:
30: GOST3411DigestTest() {
31: super (new GOST3411Digest(), messages, digests);
32: }
33:
34: public void performTest() {
35: super .performTest();
36:
37: millionATest(million_a_digest);
38: }
39:
40: protected Digest cloneDigest(Digest digest) {
41: return new GOST3411Digest((GOST3411Digest) digest);
42: }
43:
44: public static void main(String[] args) {
45: runTest(new GOST3411DigestTest());
46: }
47: }
|