Skip to content

Get SHA 256 of a string in Python

Advertisements
import hashlib


# Get the SHA256 of the string.
def get_sha_256_of_string(your_string):
    return hashlib.sha256(your_string.encode()).hexdigest()


def main():
    # Get the SHA256 of the string.
    print(get_sha_256_of_string("Hello World!"))


main()

See also  Java code snippet - How to find the largest number in an arraylist?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.