Merge pull request #3389 from lambdageek/bug-43099
[mono.git] / mcs / class / referencesource / mscorlib / system / security / cryptography / hmacsha1.cs
1 // ==++==
2 // 
3 //   Copyright (c) Microsoft Corporation.  All rights reserved.
4 // 
5 // ==--==
6 // <OWNER>[....]</OWNER>
7 // 
8
9 //
10 // HMACSHA1.cs
11 //
12
13 namespace System.Security.Cryptography {
14     [System.Runtime.InteropServices.ComVisible(true)]
15     public class HMACSHA1 : HMAC {
16         //
17         // public constructors
18         //
19
20         public HMACSHA1 () : this (Utils.GenerateRandom(64)) {}
21
22         public HMACSHA1 (byte[] key) : this (key, false) {}
23
24         public HMACSHA1 (byte[] key, bool useManagedSha1) {
25             m_hashName = "SHA1";
26 #if FEATURE_CRYPTO && !FULL_AOT_RUNTIME
27             if (useManagedSha1) {
28 #endif // FEATURE_CRYPTO
29                 m_hash1 = new SHA1Managed();
30                 m_hash2 = new SHA1Managed();
31 #if FEATURE_CRYPTO && !FULL_AOT_RUNTIME
32             } else {
33                 m_hash1 = new SHA1CryptoServiceProvider();
34                 m_hash2 = new SHA1CryptoServiceProvider();
35             }
36 #endif // FEATURE_CRYPTO
37
38             HashSizeValue = 160;
39             base.InitializeKey(key);
40         }
41     }
42 }