title: HMAC SHA256 in C# vs HMAC SHA256 in Swift don't match
body: <p>Using the 'standard' HMACSHA256 technique in dotnetcore C# I can produce a hashed string as follows:</p>
  <pre><code>private static void Test()
  {
      var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(&quot;testingkey&quot;));
      var theHash = hmac.ComputeHash(Encoding.UTF8.GetBytes(&quot;testingstringtohash&quot;));
      string signature = Convert.ToBase64String(theHash);
      Console.WriteLine(signature);
  }
  //Produces yg/9NCAm5IIwGKJK80PyUeBWkzEUwZswvC3OVnTnT80=
  </code></pre>
  <p>To do the same in swift (solution from <a href="https://stackoverflow.com/a/52785143/308791">this</a> answer seems to be the 'standard' that people are using)</p>
  <pre><code>func HashTest() {
      let hash = &quot;testingstringtohash&quot;.hmac(algorithm: .SHA256, key: &quot;testingkey&quot;)
      //hash ca0ffd342026e4823018a24af343f251e056933114c19b30bc2dce5674e74fcd
      let hexData = hash.data(using: String.Encoding.utf8)
      let signature = hexData?.base64EncodedString()
      print(signature!)
  }
  //Produces Y2EwZmZkMzQyMDI2ZTQ4MjMwMThhMjRhZjM0M2YyNTFlMDU2OTMzMTE0YzE5YjMwYmMyZGNlNTY3NGU3NGZjZA==
  </code></pre>
  <p>Am I being stupid here... or should these two values be the same, as it is the same encryption algorithm, and the same key for the same value. As far as I can tell the C# example produces the 'correct' result, as a webservice that is consuming a value produced with that example works fine, but the value that the swift version produces is failing.</p>