Write a Python program that prints the SHA256 hash of "Hello World" in hexadecimal.

Write a Python program that prints the SHA256 hash of "Hello World" in hexadecimal.


import hashlib
import codecs

def sha256(s):
    encoded = s.encode()
    hash_object = hashlib.sha256(encoded)
    print(hash_object.digest())
    return(hash_object.digest())

encoded_digest = sha256("Hello World")
print("Hexadecimal of SHA256 hashed message:", codecs.encode(encoded_digest, 'hex'))

# ```
# 21:14:28 › python3 hello_world.py
# b'\xa5\x91\xa6\xd4\x0b\xf4 @J\x01\x173\xcf\xb7\xb1\x90\xd6,e\xbf\x0b\xcd\xa3+W\xb2w\xd9\xad\x9f\x14n'
# Hexadecimal of SHA256 hashed message: b'a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e'
# ```


Learn More :