I have the following code in ruby:
hex = Digest::SHA1.hexdigest(str).to_i(16)
hex.to_s(32)
And I tried to implement it in python:
import hashlib
import base64
base64.b32encode(hashlib.sha1(str).digest())
When I run the code for the string test
in ruby I get l558vpecm6dqc72c11pt74f9guc2veuj
While in python I get VFFI7ZOMWGN2MHCMBBZ5HEPJQ6MC7O6T
What is wrong with the python code? How to get the same results as for ruby?