forked from kishanrajput23/Hacktoberfest_2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hashing.py
20 lines (15 loc) · 669 Bytes
/
hashing.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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())