01: package org.bouncycastle.crypto.test;
02:
03: import org.bouncycastle.crypto.Digest;
04: import org.bouncycastle.crypto.digests.SHA224Digest;
05:
06: /**
07: * standard vector test for SHA-224 from RFC 3874 - only the last three are in
08: * the RFC.
09: */
10: public class SHA224DigestTest extends DigestTest {
11: private static String[] messages = { "", "a", "abc",
12: "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" };
13:
14: private static String[] digests = {
15: "d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f",
16: "abd37534c7d9a2efb9465de931cd7055ffdb8879563ae98078d6d6d5",
17: "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7",
18: "75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525" };
19:
20: // 1 million 'a'
21: static private String million_a_digest = "20794655980c91d8bbb4c1ea97618a4bf03f42581948b2ee4ee7ad67";
22:
23: SHA224DigestTest() {
24: super (new SHA224Digest(), messages, digests);
25: }
26:
27: public void performTest() {
28: super .performTest();
29:
30: millionATest(million_a_digest);
31: }
32:
33: protected Digest cloneDigest(Digest digest) {
34: return new SHA224Digest((SHA224Digest) digest);
35: }
36:
37: public static void main(String[] args) {
38: runTest(new SHA224DigestTest());
39: }
40: }
|