Use getpass instead of input function for password

This commit is contained in:
2018-06-12 13:59:39 +02:00
parent e9a0d8fd4b
commit 3fc9bede22

View File

@@ -4,6 +4,7 @@ from Crypto.Cipher import AES
from Crypto.Util import Padding from Crypto.Util import Padding
from Crypto.Hash import HMAC, SHA256 from Crypto.Hash import HMAC, SHA256
import sys import sys
from getpass import getpass
IV_LENGTH = 16 IV_LENGTH = 16
NONCE_LENGTH = 16 NONCE_LENGTH = 16
MAC_LENGTH = 16 MAC_LENGTH = 16
@@ -29,7 +30,7 @@ def generate_key(password):
return m.digest() return m.digest()
def main(): def main():
password = input('Password: ') password = getpass()
key = generate_key(password.encode('utf-8')) key = generate_key(password.encode('utf-8'))
# generate string to be pasted in Signal-Desktop # generate string to be pasted in Signal-Desktop