summaryrefslogtreecommitdiff
path: root/common/security.py
blob: e3ab5de002e01c9197453c5361a71b8c004a62bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from passlib.context import CryptContext
from six.moves import configparser

config = configparser.ConfigParser()
config.read("mach2.ini")

secret_key = config.get("DEFAULT", "secret_key")

pwd_context = CryptContext(
    schemes=["pbkdf2_sha256", "des_crypt"],
    default="pbkdf2_sha256",

    # vary rounds parameter randomly when creating new hashes...
    all__vary_rounds=0.1,

    # set the number of rounds that should be used...
    # (appropriate values may vary for different schemes,
    # and the amount of time you wish it to take)
    pbkdf2_sha256__default_rounds=8000,
    )