when using the following javascript code:
var username = "TEST"; var password = "test"; var key = "6591bbcb28880da7e7b91154ec39a9d5"; var latin_parsed = CryptoJS.enc.Latin1.parse(password + username); var message = CryptoJS.SHA1(latin_parsed); var key_hex = CryptoJS.enc.Hex.parse(key); var hash_password = CryptoJS.HmacSHA1(message, key_hex) var hash_password_hex = hash_password.toString(CryptoJS.enc.Hex); // Above code gives this output: // hash_password_hex == "2f0dc5257278493636a30fe5d3eeda43f4d8d8c1" A live example can be seen here: https://jsfiddle.net/Ld7469vh/
I have tried with the following Python code, but the hash are not similar.
https://gist.github.com/heskyji/5167567b64cb92a910a3
But the hash are not similar. It seems like CryptoJS returns WordsArray and not strings. So my issue might rely on that difference, but I am not sure how to create a 1:1 solution in python.