From 5f39bd591cd54a1747518d99b723991383a8a9de Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Tue, 21 Jan 2014 17:20:04 +0700 Subject: Add new files to project, rename Sm3 to SM3 --- crypto/test/src/crypto/test/RegressionTest.cs | 8 +-- crypto/test/src/crypto/test/SM3DigestTest.cs | 74 +++++++++++++++++++++++++++ crypto/test/src/crypto/test/Sm3DigestTest.cs | 74 --------------------------- 3 files changed, 78 insertions(+), 78 deletions(-) create mode 100644 crypto/test/src/crypto/test/SM3DigestTest.cs delete mode 100644 crypto/test/src/crypto/test/Sm3DigestTest.cs (limited to 'crypto/test') diff --git a/crypto/test/src/crypto/test/RegressionTest.cs b/crypto/test/src/crypto/test/RegressionTest.cs index 4b639005e..8bc8e8339 100644 --- a/crypto/test/src/crypto/test/RegressionTest.cs +++ b/crypto/test/src/crypto/test/RegressionTest.cs @@ -97,9 +97,9 @@ namespace Org.BouncyCastle.Crypto.Tests new Rfc3211WrapTest(), new SeedTest(), new NaccacheSternTest(), - new Salsa20Test(), - new XSalsa20Test(), - new ChaChaTest(), + new Salsa20Test(), + new XSalsa20Test(), + new ChaChaTest(), new CMacTest(), new EaxTest(), new GcmTest(), @@ -117,7 +117,7 @@ namespace Org.BouncyCastle.Crypto.Tests new SipHashTest(), new Poly1305Test(), new OcbTest(), - new Sm3DigestTest() + new SM3DigestTest() }; public static void Main( diff --git a/crypto/test/src/crypto/test/SM3DigestTest.cs b/crypto/test/src/crypto/test/SM3DigestTest.cs new file mode 100644 index 000000000..b1e93059e --- /dev/null +++ b/crypto/test/src/crypto/test/SM3DigestTest.cs @@ -0,0 +1,74 @@ +using System; + +using NUnit.Framework; + +using Org.BouncyCastle.Crypto; +using Org.BouncyCastle.Crypto.Digests; +using Org.BouncyCastle.Utilities.Encoders; +using Org.BouncyCastle.Utilities.Test; + +namespace Org.BouncyCastle.Crypto.Tests +{ + /** + * standard vector test for SM3 digest from chinese specification + */ + [TestFixture] + public class SM3DigestTest + : DigestTest + { + private static string[] messages = { + // Standard test vectors + "abc", + "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd", + // Non-standard test vectors + "", + "a", + "abcdefghijklmnopqrstuvwxyz", + }; + + private static string[] digests = { + // Standard test vectors + "66c7f0f462eeedd9d1f2d46bdc10e4e24167c4875cf2f7a2297da02b8f4ba8e0", + "debe9ff92275b8a138604889c18e5a4d6fdb70e5387e5765293dcba39c0c5732", + // Non-standard test vectors + "1ab21d8355cfa17f8e61194831e81a8f22bec8c728fefb747ed035eb5082aa2b", + "623476ac18f65a2909e43c7fec61b49c7e764a91a18ccb82f1917a29c86c5e88", + "b80fe97a4da24afc277564f66a359ef440462ad28dcc6d63adb24d5c20a61595", + }; + + private static string sixtyFourKdigest = "97049bdc8f0736bc7300eafa9980aeb9cf00f24f7ec3a8f1f8884954d7655c1d"; + private static string million_a_digest = "c8aaf89429554029e231941a2acc0ad61ff2a5acd8fadd25847a3a732b3b02c3"; + + internal SM3DigestTest() + : base(new SM3Digest(), messages, digests) + { + } + + public override void PerformTest() + { + base.PerformTest(); + + sixtyFourKTest(sixtyFourKdigest); + millionATest(million_a_digest); + } + + protected override IDigest CloneDigest(IDigest digest) + { + return new SM3Digest((SM3Digest)digest); + } + + public static void Main( + string[] args) + { + RunTest(new SM3DigestTest()); + } + + [Test] + public void TestFunction() + { + string resultText = Perform().ToString(); + + Assert.AreEqual(Name + ": Okay", resultText); + } + } +} diff --git a/crypto/test/src/crypto/test/Sm3DigestTest.cs b/crypto/test/src/crypto/test/Sm3DigestTest.cs deleted file mode 100644 index 3d004deaa..000000000 --- a/crypto/test/src/crypto/test/Sm3DigestTest.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System; - -using NUnit.Framework; - -using Org.BouncyCastle.Crypto; -using Org.BouncyCastle.Crypto.Digests; -using Org.BouncyCastle.Utilities.Encoders; -using Org.BouncyCastle.Utilities.Test; - -namespace Org.BouncyCastle.Crypto.Tests -{ - /** - * standard vector test for SM3 digest from chinese specification - */ - [TestFixture] - public class Sm3DigestTest - : DigestTest - { - private static string[] messages = { - // Standard test vectors - "abc", - "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd", - // Non-standard test vectors - "", - "a", - "abcdefghijklmnopqrstuvwxyz", - }; - - private static string[] digests = { - // Standard test vectors - "66c7f0f462eeedd9d1f2d46bdc10e4e24167c4875cf2f7a2297da02b8f4ba8e0", - "debe9ff92275b8a138604889c18e5a4d6fdb70e5387e5765293dcba39c0c5732", - // Non-standard test vectors - "1ab21d8355cfa17f8e61194831e81a8f22bec8c728fefb747ed035eb5082aa2b", - "623476ac18f65a2909e43c7fec61b49c7e764a91a18ccb82f1917a29c86c5e88", - "b80fe97a4da24afc277564f66a359ef440462ad28dcc6d63adb24d5c20a61595", - }; - - private static string sixtyFourKdigest = "97049bdc8f0736bc7300eafa9980aeb9cf00f24f7ec3a8f1f8884954d7655c1d"; - private static string million_a_digest = "c8aaf89429554029e231941a2acc0ad61ff2a5acd8fadd25847a3a732b3b02c3"; - - internal Sm3DigestTest() - : base(new Sm3Digest(), messages, digests) - { - } - - public override void PerformTest() - { - base.PerformTest(); - - sixtyFourKTest(sixtyFourKdigest); - millionATest(million_a_digest); - } - - protected override IDigest CloneDigest(IDigest digest) - { - return new Sm3Digest((Sm3Digest)digest); - } - - public static void Main( - string[] args) - { - RunTest(new Sm3DigestTest()); - } - - [Test] - public void TestFunction() - { - string resultText = Perform().ToString(); - - Assert.AreEqual(Name + ": Okay", resultText); - } - } -} -- cgit 1.4.1