This documentation is archived and is not being maintained.

HMACSHA1.HMACSHA1(Byte[], Boolean) Constructor

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
Not applicable.



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 Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0