コード例 #1
0
# -*- coding: utf-8 -*-
""" An example of functions in the common library"""

from com_lib.logging_config import config_logging
from com_lib.pass_lib import encrypt_pass
from com_lib.pass_lib import verify_pass

config_logging()


def hash_pass(pwd: str):

    hashed_pwd = encrypt_pass(pwd)
    return hashed_pwd


def hash_pass_verify(pwd: str, crypt_pwd: str) -> bool:

    check = verify_pass(pwd, crypt_pwd)
    return check


def main():
    pwd = "toast"
    crypt_pwd = hash_pass(pwd)
    print(crypt_pwd)

    result = hash_pass_verify(pwd, crypt_pwd)

    if result == True:
        print("first check of password is valid")
コード例 #2
0
def init_app():

    config_logging()
    logger.info(f"Initiating application")
    create_db()
    logger.info(f"Initiating database")