From 9f920ec414e42b429ab8c4e8a29eaa8319e659e7 Mon Sep 17 00:00:00 2001 From: UnitedAirforce Date: Fri, 14 Feb 2025 18:48:19 +0800 Subject: [PATCH] back to bcrypt --- 7001.py | 8 +++++--- README.md | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/7001.py b/7001.py index d63c517..46359b4 100644 --- a/7001.py +++ b/7001.py @@ -3,7 +3,7 @@ from config import Config import os import sqlite3 import binascii -from passlib.hash import bcrypt +import bcrypt import re from datetime import datetime import xml.etree.ElementTree as ET @@ -206,10 +206,12 @@ def crc32_decimal(data): return int(crc32_hex & 0xFFFFFFFF) def hash_password(password): - return bcrypt.hash(password) + salt = bcrypt.gensalt() + hashed_password = bcrypt.hashpw(password.encode('utf-8'), salt) + return hashed_password def verify_password(password, hashed_password): - return bcrypt.verify(password, hashed_password) + return bcrypt.checkpw(password.encode('utf-8'), hashed_password) def is_alphanumeric(username): pattern = r"^[a-zA-Z0-9]+$" diff --git a/README.md b/README.md index 4dcbe95..fc0b206 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Download common.zip and a platform of your choosing. Unzip the folders within to - Crypto (pycryptodome) -- Passlib +- bcrypt - requests @@ -106,7 +106,7 @@ Use `pip install ...` -to install `flask`, `passlib`, `pycryptodome`, `requests`. +to install `rust`, `flask`, `passlib`, `pycryptodome`, `requests`. If ssl errors pop up, you might need to ``pkg up ssl -y``. @@ -276,7 +276,7 @@ With the current setup, if a `device` is playing with an associated `account`, t - Crypto (pycryptodome) -- Passlib +- bcrypt - requests @@ -331,7 +331,7 @@ PC用文本编辑器打开服务器文件夹的 `config.py`,将`IPV4`填写至 `pip install ...` -来安装 `flask`, `passlib`, `pycryptodome`, `requests`. +来安装 `rust`, `flask`, `bcrypt`, `pycryptodome`, `requests`. 如果出现ssl问题,可能需要``pkg up ssl -y``.