KalleHallden / pwManager

184 stars 74 forks source link

Unused variable / functions #2

Open runarmod opened 4 years ago

runarmod commented 4 years ago

The variable num on line 23 num = int(raw_hex, 16) of hash_maker.py is unused, which makes 2 functions and an additional line useless (unless they are used in secret.py which I don't believe).

The following lines are only used to create a value for the variable num, which is unused (all in hash_maker.py)

raw_hex = make_password(plaintext, app_name)
def make_password(plaintext, app_name):
    salt = get_hexdigest(SECRET_KEY, app_name)[:20]
    hsh = get_hexdigest(salt, plaintext)
    return ''.join((salt, hsh))

def get_hexdigest(salt, plaintext):
    return sha256((salt + plaintext).encode('utf-8')).hexdigest()
ansel2000 commented 3 years ago

Yea just realized that. Like the password is actually made using a random assortment of letters and characters. So it isn't actually hashed and doesn't actually use the app name and or the super key for making the password.

def password(plaintext, app_name, length):
    raw_hex = make_password(plaintext, app_name)
    ALPHABET = ('abcdefghijklmnopqrstuvwxyz', '0123456789', 'ABCDEFGHIJKLMNOPQRSTYVWXYZ', '(,._-*~"<>/|!@#$%^&)+=')

    num = int(raw_hex, 16)

    chars = []

    while len(chars) < length:
        n = random.randint(0, len(ALPHABET) - 1)
        alpha = ALPHABET[n]
        n = random.randint(0, len(alpha) - 1)
        chars.append(alpha[n])

    return ''.join(chars)

This is like a random password generator and storage more than a password manager.

JustinDroege commented 3 years ago

This exactly shows how Kalle doesnt really know what he is doing