1# Hash Function
2# SHA hash algorithms.
3
4import hashlib
5
6# initializing string
7str = "TYCS"
8
9# encoding TYCS using encode()
10# then sending to SHA1()
11result = hashlib.sha1(str.encode())
12
13# printing the equivalent hexadecimal value.
14print("The hexadecimal equivalent of SHA1 is : ")
15print(result.hexdigest())
16
17# encoding TYCS using encode()
18# then sending to SHA224()
19result = hashlib.sha224(str.encode())
20
21# printing the equivalent hexadecimal value.
22print("The hexadecimal equivalent of SHA224 is : ")
23print(result.hexdigest())
24
25# encoding TYCS using encode()
26# then sending to SHA256()
27result = hashlib.sha256(str.encode())
28
29# printing the equivalent hexadecimal value.
30print("The hexadecimal equivalent of SHA256 is : ")
31print(result.hexdigest())
32
33# initializing string
34str = "TYCS"
35
36# encoding TYCS using encode()
37# then sending to SHA384()
38result = hashlib.sha384(str.encode())
39
40# printing the equivalent hexadecimal value.
41print("The hexadecimal equivalent of SHA384 is : ")
42print(result.hexdigest())
43
44# initializing string
45str = "TYCS"
46
47# initializing string
48str = "TYCS"
49
50# encoding TYCS using encode()
51# then sending to SHA512()
52result = hashlib.sha512(str.encode())
53
54# printing the equivalent hexadecimal value.
55print("The hexadecimal equivalent of SHA512 is : ")
56print(result.hexdigest())