title: Interop: HmacSHA1 in Java and dotNet
body: <p>In an app we are calculating a SHA1Hmac in java using the following:</p>
  
  <pre><code>SecretKey key = new SecretKeySpec(secret, "HmacSHA1");
  Mac m = Mac.getInstance("HmacSHA1");
  m.init(key);
  byte[] hmac = m.doFinal(data);
  </code></pre>
  
  <p>And later, the hmac is verified in C# - on a SmartCard - using:</p>
  
  <pre><code>  HMACSHA1 hmacSha = new HMACSHA1(secret);
    hmacSha.Initialize();
    byte[] hmac = hmacSha.ComputeHash(data);
  </code></pre>
  
  <p>However, the result is not the same. Did I overlook something important?</p>
  
  <p>The inputs seem to be the same. Here some sample inputs:</p>
  
  <pre><code>Data: 546573746461746131323341fa3c35
  Key: 6d795472616e73616374696f6e536563726574
  
  Result Java: 37dbde318b5e88acbd846775e38b08fe4d15dac6
  Result C#:   dd626b0be6ae78b09352a0e39f4d0e30bb3f8eb9
  </code></pre>
  
  <p>I wouldn't mind to implement my own hmacsha1 on both platforms, but using what already exists....</p>
  
  <p>Thanks!</p>