This documentation is archived and is not being maintained.

HMACSHA1 Constructor (Byte[], Boolean)

Note: This constructor is new in the .NET Framework version 2.0.

Initializes a new instance of the HMACSHA1 class with the specified key data and a value that specifies whether to use the managed version of the SHA1 Algorithm.

Namespace: System.Security.Cryptography
Assembly: mscorlib (in mscorlib.dll)

public HMACSHA1 (
	byte[] key,
	bool useManagedSha1
public HMACSHA1 (
	byte[] key, 
	boolean useManagedSha1
public function HMACSHA1 (
	key : byte[], 
	useManagedSha1 : boolean



The secret key for HMACSHA1 encryption. The key can be any length but if it is more than 64 bytes long, it will be hashed (using SHA-1) to derive a 64-byte key. Therefore, the recommended size of the secret key is 64 bytes.


true to use the managed implementation of the SHA1 algorithm (the SHA1Managed class); false to use the unmanaged implementation (the SHA1CryptoServiceProvider class).

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0