title: KeyedHashAlgorithm in .net core
body: <p>I need to convert the following .Net code to .Net Core:</p>
  
  <pre><code>static byte[] HmacSHA256(String data, byte[] key)
  {
      String algorithm = "HmacSHA256";
      KeyedHashAlgorithm kha = KeyedHashAlgorithm.Create(algorithm);
      kha.Key = key;
  
      return kha.ComputeHash(Encoding.UTF8.GetBytes(data));
  }
  </code></pre>
  
  <p>The above snippet is used for Amazon AWS key signing and is taken from <a href="http://docs.aws.amazon.com/general/latest/gr/signature-v4-examples.html#signature-v4-examples-dotnet" rel="nofollow noreferrer">here</a>.</p>
  
  <p>I'm using System.Security.Cryptography.Primitives 4.3.0 and KeyedHashAlgorithm.Create method doesn't exists. Looking at the <a href="https://github.com/dotnet/corefx/blob/9d42f078b13a8f8a437914094699ab80bfd1fd42/src/System.Security.Cryptography.Primitives/src/System/Security/Cryptography/KeyedHashAlgorithm.cs" rel="nofollow noreferrer">github</a> I can see that the Create method is there now, but it's not supported:</p>
  
  <pre><code> public static new KeyedHashAlgorithm Create(string algName)
          {
              throw new PlatformNotSupportedException();
  }
  </code></pre>
  
  <p>The question is what is my alternative to KeyedHashAlgorithm.Create(string algName) in .Net Core? </p>