Bump Codebase Version

This commit is contained in:
App Generator
2021-11-10 17:17:23 +02:00
parent 94e62b6ea9
commit 32f93f463e
227 changed files with 35126 additions and 0 deletions

View File

@ -0,0 +1,34 @@
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""
import os
import hashlib
import binascii
# Inspiration -> https://www.vitoshacademy.com/hashing-passwords-in-python/
def hash_pass(password):
"""Hash a password for storing."""
salt = hashlib.sha256(os.urandom(60)).hexdigest().encode('ascii')
pwdhash = hashlib.pbkdf2_hmac('sha512', password.encode('utf-8'),
salt, 100000)
pwdhash = binascii.hexlify(pwdhash)
return (salt + pwdhash) # return bytes
def verify_pass(provided_password, stored_password):
"""Verify a stored password against one provided by user"""
stored_password = stored_password.decode('ascii')
salt = stored_password[:64]
stored_password = stored_password[64:]
pwdhash = hashlib.pbkdf2_hmac('sha512',
provided_password.encode('utf-8'),
salt.encode('ascii'),
100000)
pwdhash = binascii.hexlify(pwdhash).decode('ascii')
return pwdhash == stored_password