def makeCred(account, password): cred = Credential() cred.prf = "HMAC+SHA256" cred.salt = crypto.get_random_string() cred.iterations = 20000 cred.hash = base64.b64encode(crypto.pbkdf2(password, cred.salt, iterations=cred.iterations)) cred.account = account return cred