(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / class / corlib / Test / System.Security.Cryptography / SHA256ManagedTest.cs
blobf64c11cbe4f3c81a182f1d46df908f4b2648c5dd
1 //
2 // SHA256ManagedTest.cs - NUnit Test Cases for SHA256Managed
3 //
4 // Author:
5 // Sebastien Pouliot <sebastien@ximian.com>
6 //
7 // (C) 2002 Motus Technologies Inc. (http://www.motus.com)
8 // (C) 2004 Novell http://www.novell.com
9 //
11 using NUnit.Framework;
12 using System;
13 using System.Security.Cryptography;
14 using System.Text;
16 namespace MonoTests.System.Security.Cryptography {
18 // References:
19 // a. FIPS PUB 180-2: Secure Hash Standard
20 // http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf
22 // we inherit from SHA256Test because all SHA256 implementation must return the
23 // same results (hence should run a common set of unit tests).
25 [TestFixture]
26 public class SHA256ManagedTest : SHA256Test {
28 [SetUp]
29 protected override void SetUp ()
31 hash = new SHA256Managed ();
34 [Test]
35 public override void Create ()
37 // no need to repeat this test
40 // none of those values changes for a particuliar implementation of SHA256
41 [Test]
42 public override void StaticInfo ()
44 // test all values static for SHA256
45 base.StaticInfo ();
46 string className = hash.ToString ();
47 AssertEquals (className + ".CanReuseTransform", true, hash.CanReuseTransform);
48 AssertEquals (className + ".CanTransformMultipleBlocks", true, hash.CanTransformMultipleBlocks);
49 AssertEquals (className + ".ToString()", "System.Security.Cryptography.SHA256Managed", className);
52 [Test]
53 public void FIPSCompliance_Test1 ()
55 SHA256 sha = (SHA256) hash;
56 // First test, we hash the string "abc"
57 FIPS186_Test1 (sha);
60 [Test]
61 public void FIPSCompliance_Test2 ()
63 SHA256 sha = (SHA256) hash;
64 // Second test, we hash the string "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"
65 FIPS186_Test2 (sha);
68 [Test]
69 public void FIPSCompliance_Test3 ()
71 SHA256 sha = (SHA256) hash;
72 // Third test, we hash 1,000,000 times the character "a"
73 FIPS186_Test3 (sha);