helpers.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:commctl 作者: projectatomic 项目源码 文件源码
def do_passhash(args):
    """
    Uses bcrypt to hash a password.

    :param args: Parsed ArgumentParser args
    :type args: argparse.Namespace
    :returns: The hashed password
    :rtype: str
    """
    import bcrypt

    if args.password is not None:
        pw = args.password
    elif args.file is not None:
        pw = args.file.read()
    else:
        import getpass
        pw = getpass.getpass()
    salt = bcrypt.gensalt(log_rounds=args.rounds)
    return bcrypt.hashpw(pw, salt)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号