Skip to content

Instantly share code, notes, and snippets.

@Arpan-206
Created July 23, 2021 09:24
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 Arpan-206/0cd9db51237ff6dd1b07106d62f94dd1 to your computer and use it in GitHub Desktop.
Save Arpan-206/0cd9db51237ff6dd1b07106d62f94dd1 to your computer and use it in GitHub Desktop.
import hashlib # Importing the hashlib library.
# Encoding the text into bytes and storing it in the variable 'meaasage'.
message = "Hi! This is something to encode.".encode()
# The MD5 hash.
print("MD5:", hashlib.md5(message).hexdigest())
# The SHA2 hashes.
print("SHA-256:", hashlib.sha256(message).hexdigest())
print("SHA-512:", hashlib.sha512(message).hexdigest())
# The SHA3 hashes.
print("SHA-3-256:", hashlib.sha3_256(message).hexdigest())
print("SHA-3-512:", hashlib.sha3_512(message).hexdigest())
# 256-bit Blake2 hash.
print("BLAKE2c:", hashlib.blake2s(message).hexdigest())
# 512-bit BLAKE2 hash.
print("BLAKE2b:", hashlib.blake2b(message).hexdigest())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment