python hex hmac md5 of passwords not matching javascript
<p>i have a javascript  password coder  </p>

<blockquote>
  <p>md5 = hex_hmac_md5(secret, password)</p>
</blockquote>

<p>How can i emulate this in python - ive tried md5 but that is not the same value</p>

<p>i got my md5 javascript code from this website:</p>

<p><a href="http://pajhome.org.uk/crypt/md5/instructions.html" rel="nofollow">Pajs Home</a></p>

<p>(md5.js)</p>

<p>He states the use is as follows:</p>

<blockquote>
  <p>In many uses of hashes you end up
  wanting to combine a key with some
  data. It isn't so bad to do this by
  simple concatenation, but HMAC is
  specifically designed for this use.
  The usage is:</p>
  
  
      hash = hex_hmac_md5("key", "data"); 
  
  <p>The HMAC result is also available
  base-64 encoded or as a binary string,
  using b64_hmac_* or str_hmac_*.</p>
  
  <p>Some other hash libraries have the
  arguments the other way round. If the
  JavaScript HMAC doesn't match the
  value your server library generates,
  try swapping the order.</p>
</blockquote>

<p>I have tried some python like this:</p>

<pre><code>&gt; def md5_test(secret, password):
&gt;     
&gt;     return md5(secret+password).hexdigest()
</code></pre>

<p>Can anyone tell me what the code should be in python to get the same value?</p>

<p>Thanks</p>
