title: Generate Base64 MD5 hash of byte array
body: <p>I have following security encoding implemented in my c# web api:</p>
  
  <pre><code>string testStr = "test";
  ASCIIEncoding encoding = new ASCIIEncoding();    //using System.Text;
  byte[] byteData = encoding.GetBytes(testStr);
  
  MD5 md5 = MD5.Create();    //using System.Security.Cryptography;
  string hash = md5.ComputeHash(byteData);
  string md5Base64 = Convert.ToBase64String(hash);
  </code></pre>
  
  <p>I bind this <code>md5Base64</code> string in header and compare it in API request. This works fine when I hit the API from C# code. Now I need to use it in javascript, so will need js equivalent of above code.</p>
  
  <p>I have tried following but it is giving different output:</p>
  
  <pre><code>var testStr = 'test';
  var byteData = testStr.split ('').map(function (c) { return c.charCodeAt (0); });
  var hash = MD5(value.join(','));
  var md5Base64 = btoa(hash);
  </code></pre>
  
  <p>the <code>MD5</code> function used here is from <a href="https://stackoverflow.com/a/33486055/7519287">https://stackoverflow.com/a/33486055/7519287</a></p>
  
  <p>Please let me know what is wrong here.</p>