Skip to content

Commit

Permalink
Randomness on the salt file!
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitjosh78 authored Nov 19, 2020
1 parent 96b2e68 commit 6fae1fe
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions password_Manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
import string
import random
import os

# Sample Space
sampleSpace = string.ascii_letters + string.digits + string.punctuation
Expand Down Expand Up @@ -51,12 +52,12 @@ def keyDeriving(masterPassword, salt=None):
# Making a salt file
if salt != None:
with open("salt.txt", "w") as slt:
slt.write(salt.decode())
slt.write(salt.decode('cp1252'))

#When the salt file is already present
elif salt == None:
with open("salt.txt") as slt:
salt = slt.read().encode()
salt = slt.read().encode('cp1252')

# One time process of deriving key from master password and salt.

Expand Down Expand Up @@ -173,7 +174,7 @@ def helpSection():


# One time process
salt = b'salt_'
salt = os.urandom(16)
key = keyDeriving(masterPassword, salt)


Expand Down

0 comments on commit 6fae1fe

Please sign in to comment.