3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-23 19:19:31 +01:00

login: Use a slightly faster CryptContext

This commit is contained in:
James Lu 2016-11-19 17:47:55 -08:00
parent c4351d61c6
commit ffc271a53a
3 changed files with 9 additions and 4 deletions

View File

@ -4,7 +4,12 @@ login.py - Implement core login abstraction.
from pylinkirc import conf, utils, world from pylinkirc import conf, utils, world
from pylinkirc.log import log from pylinkirc.log import log
from passlib.apps import custom_app_context as pwd_context from passlib.context import CryptContext
pwd_context = CryptContext(["sha512_crypt", "sha256_crypt"],
all__vary_rounds=0.1,
sha256_crypt__default_rounds=180000,
sha512_crypt__default_rounds=90000)
def checkLogin(user, password): def checkLogin(user, password):
"""Checks whether the given user and password is a valid combination.""" """Checks whether the given user and password is a valid combination."""

View File

@ -51,7 +51,7 @@ login:
user1: user1:
# Defines the password for the user. You can encrypt passwords using the # Defines the password for the user. You can encrypt passwords using the
# 'mkpasswd' command or the 'pylink-mkpasswd' utility included with PyLink. # 'mkpasswd' command or the 'pylink-mkpasswd' utility included with PyLink.
password: "$6$rounds=617998$BwHhwX4wB5R0H9uw$Lyo.4icYjVSnSCDsjNIO5Ap5LAcyqLspBcUqVR0qlIB9o6vKU.WyrttHZum4dVW35cuc2wGP2SKa5Bv/svdiv1" password: "$6$rounds=81447$WlVlZYCgbnjPmVqy$28Tu/Zl0xNpePqimax2wABKn5GCoWomYEI1Pu5jqYyQNULazR4BxQmscZ0MgBHqBCCke.3u5eOtBSZwL3WwVf0"
# Determines whether the password given is in plain-text. Defaults to false # Determines whether the password given is in plain-text. Defaults to false
# (plain text) for backwards compatibility. # (plain text) for backwards compatibility.

View File

@ -3,8 +3,8 @@
Password hashing utility for PyLink IRC Services. Password hashing utility for PyLink IRC Services.
""" """
import passlib #import passlib
from passlib.apps import custom_app_context as pwd_context from pylinkirc.coremods.login import pwd_context
if __name__ == '__main__': if __name__ == '__main__':
import argparse import argparse