How to Hash a String value in Python?

The following code is an example of hashing a string value in Python:


import hashlib
import json

str_text = "Hello, Hashing a String value in Python" 
result = hashlib.md5(str_text.encode('utf-8'))
hash_value = result.hexdigest()

print("String hash value = ", hash_value)
Output:
String hash value = fd56d247cea9e254712ad06aa40e40c9