hashable in python code example
Example 1: python hash function
import hashlib
str = "TYCS"
result = hashlib.sha1(str.encode())
print("The hexadecimal equivalent of SHA1 is : ")
print(result.hexdigest())
result = hashlib.sha224(str.encode())
print("The hexadecimal equivalent of SHA224 is : ")
print(result.hexdigest())
result = hashlib.sha256(str.encode())
print("The hexadecimal equivalent of SHA256 is : ")
print(result.hexdigest())
str = "TYCS"
result = hashlib.sha384(str.encode())
print("The hexadecimal equivalent of SHA384 is : ")
print(result.hexdigest())
str = "TYCS"
str = "TYCS"
result = hashlib.sha512(str.encode())
print("The hexadecimal equivalent of SHA512 is : ")
print(result.hexdigest())
Example 2: hash table in python
dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}
name = dict["Name"]
Example 3: hash in python
hash(object)
Example 4: Hashing in python
Hashing implementation at this link:
https://github.com/shreyasvedpathak/Data-Structure-Python/tree/master/Hashing