mirror of
https://github.com/qwerfd2/Groove_Coaster_2_Server.git
synced 2025-12-24 04:30:25 +00:00
back to bcrypt
This commit is contained in:
8
7001.py
8
7001.py
@@ -3,7 +3,7 @@ from config import Config
|
|||||||
import os
|
import os
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import binascii
|
import binascii
|
||||||
from passlib.hash import bcrypt
|
import bcrypt
|
||||||
import re
|
import re
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
@@ -206,10 +206,12 @@ def crc32_decimal(data):
|
|||||||
return int(crc32_hex & 0xFFFFFFFF)
|
return int(crc32_hex & 0xFFFFFFFF)
|
||||||
|
|
||||||
def hash_password(password):
|
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):
|
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):
|
def is_alphanumeric(username):
|
||||||
pattern = r"^[a-zA-Z0-9]+$"
|
pattern = r"^[a-zA-Z0-9]+$"
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ Download common.zip and a platform of your choosing. Unzip the folders within to
|
|||||||
|
|
||||||
- Crypto (pycryptodome)
|
- Crypto (pycryptodome)
|
||||||
|
|
||||||
- Passlib
|
- bcrypt
|
||||||
|
|
||||||
- requests
|
- requests
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ Use
|
|||||||
|
|
||||||
`pip install ...`
|
`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``.
|
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)
|
- Crypto (pycryptodome)
|
||||||
|
|
||||||
- Passlib
|
- bcrypt
|
||||||
|
|
||||||
- requests
|
- requests
|
||||||
|
|
||||||
@@ -331,7 +331,7 @@ PC用文本编辑器打开服务器文件夹的 `config.py`,将`IPV4`填写至
|
|||||||
|
|
||||||
`pip install ...`
|
`pip install ...`
|
||||||
|
|
||||||
来安装 `flask`, `passlib`, `pycryptodome`, `requests`.
|
来安装 `rust`, `flask`, `bcrypt`, `pycryptodome`, `requests`.
|
||||||
|
|
||||||
如果出现ssl问题,可能需要``pkg up ssl -y``.
|
如果出现ssl问题,可能需要``pkg up ssl -y``.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user