forked from willyrahmaw/password-encrypt-sha
-
Notifications
You must be signed in to change notification settings - Fork 0
/
encrypt.py
59 lines (50 loc) · 2.43 KB
/
encrypt.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import hashlib as h
class Encrypted:
def sha1(inputan):
encrypt = h.sha1(inputan.encode()).hexdigest()
print('Hasil encrypt:', encrypt)
def sha256(inputan):
encrypt = h.sha256(inputan.encode()).hexdigest()
print('Hasil encrypt:', encrypt)
def sha224(inputan):
encrypt = h.sha224(inputan.encode()).hexdigest()
print('Hasil encrypt:', encrypt)
def md5(inputan):
encrypt = h.md5(inputan.encode()).hexdigest()
print('Hasil encrypt (MD5):', encrypt)
def sha512(inputan):
encrypt = h.sha512(inputan.encode()).hexdigest()
print('Hasil encrypt (SHA-512):', encrypt)
def blake2b(inputan):
encrypt = h.blake2b(inputan.encode()).hexdigest()
print('Hasil encrypt (BLAKE2b):', encrypt)
print(""" ██╗ ██╗███████╗██╗ ██████╗ ██████╗ ███╗ ███╗███████╗
██║ ██║██╔════╝██║ ██╔════╝██╔═══██╗████╗ ████║██╔════╝
██║ █╗ ██║█████╗ ██║ ██║ ██║ ██║██╔████╔██║█████╗
██║███╗██║██╔══╝ ██║ ██║ ██║ ██║██║╚██╔╝██║██╔══╝
╚███╔███╔╝███████╗███████╗╚██████╗╚██████╔╝██║ ╚═╝ ██║███████╗
╚══╝╚══╝ ╚══════╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝
""")
inputan = input('Masukkan yang akan di-encrypt: ')
print("Pilih algoritma enkripsi:")
print("1. SHA-1")
print("2. SHA-256")
print("3. SHA-224")
print("4. MD5")
print("5. SHA-512")
print("6. BLAKE2b")
pilihan = int(input('Masukkan pilihan (1-6): '))
if pilihan == 1:
Encrypted.sha1(inputan)
elif pilihan == 2:
Encrypted.sha256(inputan)
elif pilihan == 3:
Encrypted.sha224(inputan)
elif pilihan == 4:
Encrypted.md5(inputan)
elif pilihan == 5:
Encrypted.sha512(inputan)
elif pilihan == 6:
Encrypted.blake2b(inputan)
else:
print('Pilihan tidak valid')