Welcome to mirror list, hosted at ThFree Co, Russian Federation.

SHA1DigestTest.java « test « crypto « spongycastle « org « java « test « src « core - gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ab0adae2636f65f326a78b0d3ba3dadada3333ea (plain)
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
package org.spongycastle.crypto.test;

import org.spongycastle.crypto.Digest;
import org.spongycastle.crypto.digests.SHA1Digest;

/**
 * standard vector test for SHA-1 from "Handbook of Applied Cryptography", page 345.
 */
public class SHA1DigestTest
    extends DigestTest
{
    private static String[] messages =
    {
         "",
         "a",
         "abc",
         "abcdefghijklmnopqrstuvwxyz"
    };
    
    private static String[] digests =
    {
        "da39a3ee5e6b4b0d3255bfef95601890afd80709",
        "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8",
        "a9993e364706816aba3e25717850c26c9cd0d89d",
        "32d10c7b8cf96570ca04ce37f2a19d84240d3a89"
    };
    
    SHA1DigestTest()
    {
        super(new SHA1Digest(), messages, digests);
    }

    protected Digest cloneDigest(Digest digest)
    {
        return new SHA1Digest((SHA1Digest)digest);
    }

    protected Digest cloneDigest(byte[] encodedState)
    {
        return new SHA1Digest(encodedState);
    }

    public static void main(
        String[]    args)
    {
        runTest(new SHA1DigestTest());
    }
}