def verify(password, password_verify): password = unicode_dados(password) return pbkdf2_sha256.verify(password, password_verify)
def encrypt(password): password = unicode_dados(password) return pbkdf2_sha256.encrypt(password, rounds=SecurityPassword.ROUNDS)
def decrypt(cls, token, ttl=None): token = unicode_dados(token) return cls.fernet().decrypt(token, ttl)
def verify(cls, token, key, ttl=None): key = unicode_dados(key) return cls.decrypt(token, ttl) == key
def encrypt(cls, key): key = unicode_dados(key) return cls.fernet().encrypt(key)