This repository has been archived on 2023-08-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
PassManager/src/cryptography/master_pass.py
2022-10-05 18:47:51 +03:00

15 lines
407 B
Python

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)
def encrypt_master_pass_known_salt(passwd: str, salt: bytes) -> bytes:
return bcrypt.hashpw(passwd.encode("utf-8"), salt)