New test.
[mono.git] / mcs / class / corlib / Test / System.Security.Cryptography / HMACSHA1Test.cs
index 2e64a700ddd2b08df48542078c40486c0ff4a49e..c52e203c3cdd6dd186698f77a6a7008b5ade4fae 100644 (file)
@@ -5,7 +5,7 @@
 //     Sebastien Pouliot  <sebastien@ximian.com>
 //
 // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004, 2006 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -45,6 +45,13 @@ public class HMACSHA1Test : KeyedHashAlgorithmTest {
 
        protected HMACSHA1 algo;
 
+       [SetUp]
+       protected override void SetUp () 
+       {
+               hash = HMACSHA1.Create ();
+               (hash as KeyedHashAlgorithm).Key = new byte [8];
+       }
+
        [Test]
        public void Constructors () 
        {
@@ -101,7 +108,11 @@ public class HMACSHA1Test : KeyedHashAlgorithmTest {
 
        public void CheckA (string testName, byte[] key, byte[] data, byte[] result) 
        {
+#if NET_2_0
+               algo = new HMACSHA1 (key, true);
+#else
                algo = new HMACSHA1 (key);
+#endif
                byte[] hmac = algo.ComputeHash (data);
                AssertEquals (testName + "a1", result, hmac);
                AssertEquals (testName + "a2", result, algo.Hash);
@@ -109,7 +120,11 @@ public class HMACSHA1Test : KeyedHashAlgorithmTest {
 
        public void CheckB (string testName, byte[] key, byte[] data, byte[] result) 
        {
+#if NET_2_0
+               algo = new HMACSHA1 (key, false);
+#else
                algo = new HMACSHA1 (key);
+#endif
                byte[] hmac = algo.ComputeHash (data, 0, data.Length);
                AssertEquals (testName + "b1", result, hmac);
                AssertEquals (testName + "b2", result, algo.Hash);