def get_encryption_key(self, user_pass):
# user_pass = raw_input("Enter your keyring password: ")
password = hex(random.getrandbits(512 * 8))[2:-1]
salt = hex(random.getrandbits(32 * 8))[2:-1]
pbkdf2 = hashlib.pbkdf2_hmac('sha512', password, salt, 25000, 512)
key = hashlib.new('sha256', pbkdf2).hexdigest()
IV = salt[:16]
# self.export_keyring(password, salt, user_pass)
self.password = password
self.salt = salt
return key
评论列表
文章目录