Is there a way in python to generate a short version of hashcode, SHA128 or SHA256 I tried this but its not correct way to get[extracting substring to shorten]
hashlib.sha256(str.encode('utf-8')).hexdigest()[:8]
for example if i have a string, i want 8 character hash
str = "iamtestingastringtogethash"
print(hashlib.sha256(str.encode('utf-8').hexdigest(),8))
Output: some_8char_hash
Ok i found my own fix,
hashlib.shake_256(str.encode("utf-8")).hexdigest(length=8)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With