hashlib.sha256 returned some weird characters in python
Question: In javascript the code below returned

**eec097af19ad461ac825ccce57a012543da33c986e4607475e1fe5c6dc098d0a**

    
    
    <script src="http://crypto-js.googlecode.com/svn/tags/3.0.1/build/rollups/hmac-sha512.js"></script>
    <script>
       var hash = CryptoJS.HmacSHA256("Message", "Secret");
    </script>
    

In python same logic returned some weird characters like
�����F�%��W�T=�<�nFG^��� �

    
    
    import hmac
    import hashlib
    import base64
    hash = hmac.new('Secret', "Message", hashlib.sha256).digest()
    

I think they should return same hash as i have used same algorithm for both.
Any suggestions ? Thanks


Answer: try hexdigest()

    
    
    import hmac
    import hashlib
    import base64
    hash = hmac.new('Secret', "Message", hashlib.sha256).hexdigest()
    

