Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for unicode passwords #3

Open
abbot opened this issue Feb 24, 2015 · 0 comments
Open

Add support for unicode passwords #3

abbot opened this issue Feb 24, 2015 · 0 comments
Assignees

Comments

@abbot
Copy link
Owner

abbot commented Feb 24, 2015

Copying from #2, something roughly like:

def mangle(s): return "".join(chr(ord(x) & 0xff) for x in s)

def generate(password, uri):
    """
    generate the pwdhash password for master password and uri or
    domain name.
    """
    realm = extract_domain(uri)
    if password.startswith(_password_prefix):
        password = password[len(_password_prefix):]

    password_hash = b64_hmac_md5(mangle(password), realm)
    size = len(password) + len(_password_prefix)
    nonalphanumeric = len(re.findall(r'\W', password)) != 0

    return apply_constraints(password_hash, size, nonalphanumeric)
@abbot abbot self-assigned this Feb 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant