I need to compute a hash of an integer using python 3. Is there a cleaner and more efficient solution than the following?
>>> import hashlib >>> N = 123 >>> hashlib.md5(str(N).encode("ascii")).hexdigest() '202cb962ac59075b964b07152d234b70' It seems weird to have to convert to a unicode string, then decode it to a byte array.