Skip to content

Instantly share code, notes, and snippets.

@Isaac3N

Isaac3N/hash.py Secret

Created May 15, 2022 02:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Isaac3N/66e49b6d1554e5ae63467d61c2cf0232 to your computer and use it in GitHub Desktop.
Save Isaac3N/66e49b6d1554e5ae63467d61c2cf0232 to your computer and use it in GitHub Desktop.
A gist demonstrating a sha256 cryptographic hash function in python
import hashlib
# initializing string
str = "Angie pays Christina 20 dollars"
# encoding Angie pays Christina 20 dollars using encode()
# then sending to SHA256()
result = hashlib.sha256(str.encode())
# printing the equivalent hexadecimal value.
print("The sha256 encoded message is : ")
print(result.hexdigest())
# Expected Output:
# The sha256 encoded message is : 29fcf5b89c8adcb6e757582a4a0b3f8ad2c2550f5fde94a3f1cea1dedd0a4c4d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment