Search code examples
c#.netshahmachmacsha1

Retrieve native length of hash from HMACSHA1 and HMACSHA512


I would like to get (programmatically) the native length of the HMAC function from an instance (or static method) of that class. (160 bits for SHA1, 512 for SHA512. AFAIK) Is there a way?

If not, perhaps there's a way to get it from SHA1Managed or SHA1 (and their SHA512 counterparts)?


Solution

  • A quick search shows the HashAlgorithm.HashSize property that those classes implement.