Rename internal:process to .mudpy.process
[mudpy.git] / lib / mudpy / password.py
1 """Password hashing functions and constants for the mudpy engine."""
2
3 # Copyright (c) 2004-2015 Jeremy Stanley <fungi@yuggoth.org>. Permission
4 # to use, copy, modify, and distribute this software is granted under
5 # terms provided in the LICENSE file distributed with this software.
6
7 import passlib.context
8
9 _CONTEXT = passlib.context.CryptContext(
10     all__vary_rounds=0.1, default="pbkdf2_sha512",
11     pbkdf2_sha512__default_rounds=1000, schemes=["pbkdf2_sha512"])
12
13
14 def create(password):
15     return _CONTEXT.encrypt(password)
16
17
18 def verify(password, encoded_hash):
19     return _CONTEXT.verify(password, encoded_hash)