예제 #1
0
def test_password_MD5():
    pass_string = crypt_password("secret", "MD5")
    method, salt, crypt = parse_pass(pass_string)
    assert method == "{MD5}", "method is %s, not {MD5}" % method
    assert salt is not None, "salt is None"

    md5_hash = hashlib.md5(salt)
    md5_hash.update(u"secret")

    assert crypt == md5_hash.hexdigest(), "Crypted password did not match"
예제 #2
0
def test_password_MD5():
    pass_string = crypt_password("secret", "MD5")
    method, salt, crypt = parse_pass(pass_string)
    assert method == "{MD5}", "method is %s, not {MD5}" % method
    assert salt is not None, "salt is None"

    md5_hash = hashlib.md5(salt)
    md5_hash.update(u"secret")

    assert crypt == md5_hash.hexdigest(), "Crypted password did not match"
예제 #3
0
def test_parse_pass():
    password = u"{method}$SALTSALT$PASSWORDPASSWORD"
    method, salt, crypt = parse_pass(password)
    assert method == "{method}", "failed to parse method"
    assert salt == "SALTSALT", "failed to parse salt"
    assert crypt == "PASSWORDPASSWORD"
예제 #4
0
def test_parse_pass():
    password = u"{method}$SALTSALT$PASSWORDPASSWORD"
    method, salt, crypt = parse_pass(password)
    assert method == "{method}", "failed to parse method"
    assert salt == "SALTSALT", "failed to parse salt"
    assert crypt == "PASSWORDPASSWORD"