diff options
Diffstat (limited to 'libraries/spongycastle/core/src/test/java/org/spongycastle/crypto/test/SHA1DigestTest.java')
-rw-r--r-- | libraries/spongycastle/core/src/test/java/org/spongycastle/crypto/test/SHA1DigestTest.java | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/libraries/spongycastle/core/src/test/java/org/spongycastle/crypto/test/SHA1DigestTest.java b/libraries/spongycastle/core/src/test/java/org/spongycastle/crypto/test/SHA1DigestTest.java new file mode 100644 index 000000000..0dc1bdcfd --- /dev/null +++ b/libraries/spongycastle/core/src/test/java/org/spongycastle/crypto/test/SHA1DigestTest.java @@ -0,0 +1,43 @@ +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); + } + + public static void main( + String[] args) + { + runTest(new SHA1DigestTest()); + } +} |