Search code examples
pythonhashhashcodeadler32

Convert a hashcode to its binary representation


I compute the hash code for the word "tropical" using the Adler32 algorithm. The result is the number "260768607" How can I convert the above number to its binary representation? Thank you


Solution

  • You can do this via the bin() builtin function.

    So for your number this would look like this:

    bin(260768607) # Result: '0b1111100010110000001101011111'
    

    Hope this helped, good luck!

    Edit: If you need too remove the 0b part, you can use this code:

    int(str(temp)[2:])