title: Standardized md5 hashing in typescript (Angular)
body: <p>I am trying to generate an id that is generated in the backend, in the frontend (not the best of practices, I know). The id is an Md5 hash of several (dynamically generated, i.e, I don't know the hash in advance) strings concatenated together. So what I tried to do is to use the Md5 class (in <code>ts-md5/dist/md5</code>) to create an Md5 hash:</p>
  <pre><code>getId(s1: string, s2: string, s3: string) : string {
      return Md5.hashStr(`${s1}/${s2}/${s3}`);
  }
  </code></pre>
  <p>But, the hash returned by the backend did not match the hash returned by <code>getId()</code>.</p>
  <p>Here is how I create the hash in the backend (Python):</p>
  <pre class="lang-py prettyprint-override"><code>id = hashlib.md5(&quot;some_string_seed&quot;.encode(&quot;utf-8&quot;)).hexdigest()
  </code></pre>
  <p>I thought that maybe the problem is in the encoding, but adding encoding didn't change anything:</p>
  <pre><code>encode_utf8( s )
  {
    return unescape( encodeURIComponent( s ) );
  }
  return Md5.hashStr(encode_utf8(`${s1}/${s2}/${s3}`));
  </code></pre>
  <p>I tried some basic examples but the hashes just don't match.</p>
  <p>How do I make the hashes the same? (cannot modify the backend)</p>