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

Implement Support for PBKDF2-Challenge #4

Open
MaximilianClemens opened this issue Mar 31, 2021 · 1 comment
Open

Implement Support for PBKDF2-Challenge #4

MaximilianClemens opened this issue Mar 31, 2021 · 1 comment
Assignees
Labels

Comments

@MaximilianClemens
Copy link
Owner

Added with Fritz!OS 7.24 AVM_Technical_Note - German, Englisch

They also removed the login option without username, there is now a feature to query the username before login.
Recommendation - German, Englisch

@MaximilianClemens
Copy link
Owner Author

MaximilianClemens commented Mar 31, 2021

Sample Code from the AVM Document

def calculate_pbkdf2_response(challenge: str, password:str) -> str:
    """ Calculate the response for a given challenge via PBKDF2 """
    challenge_parts = challenge.split("$")
    # Extract all necessary values encoded into the challenge
    iter1 = int(challenge_parts[1])
    salt1 = bytes.fromhex(challenge_parts[2])
    iter2 = int(challenge_parts[3])
    salt2 = bytes.fromhex(challenge_parts[4])
    # Hash twice, once with static salt...
    hash1 = hashlib.pbkdf2_hmac("sha256",password.encode(),salt1,iter1)
    # Once with dynamic salt.
    hash2 = hashlib.pbkdf2_hmac("sha256",hash1,salt2,iter2)
    return f"{challenge_parts[4]}${hash2.hex()}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant