From ba72f9f2d468ef5e0ccfb77f6e1a4c0349a3d783 Mon Sep 17 00:00:00 2001 From: StNicolay <103897650+StNicolay@users.noreply.github.com> Date: Mon, 26 Sep 2022 20:41:42 +0300 Subject: [PATCH] Created master_pass encryption function --- src/cryptography/master_pass.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/cryptography/master_pass.py diff --git a/src/cryptography/master_pass.py b/src/cryptography/master_pass.py new file mode 100644 index 0000000..61d8f91 --- /dev/null +++ b/src/cryptography/master_pass.py @@ -0,0 +1,10 @@ +import bcrypt + +print("Hi") + + +def encrypt_master_pass(passwd: str) -> tuple[bytes, bytes]: + """Hashes master password and return tuple of hashed password and salt""" + salt = bcrypt.gensalt() + hashed = bcrypt.hashpw(passwd.encode("utf-8"), salt) + return (hashed, salt)