Added username field for argon2copyparty only

This commit is contained in:
eriUNK
2026-03-07 09:51:01 -03:00
parent ced732876f
commit c7808614b6
4 changed files with 20 additions and 4 deletions

5
app.py
View File

@@ -40,6 +40,7 @@ def gensalt():
@app.route('/hash', methods=['POST'])
def do_hash():
data = request.get_json() or {}
username = data.get('username', '')
password = data.get('password', '')
salt = data.get('salt', '')
algorithm = data.get('algorithm', 'sha512')
@@ -52,6 +53,8 @@ def do_hash():
abort(400, f'Password must be at least {MIN_LEN} characters')
if algorithm == 'argon2_copyparty':
if (username == '' or username == None):
abort(400, 'Please type your username.')
specified_salt = 'LVZ1TJMdAIdLyBla6nWDexFt'
b_pass = password.encode('utf-8')
@@ -69,7 +72,7 @@ def do_hash():
)
hash_only = raw_hash_copyparty.split(b"$")[-1].decode('utf-8')
final_hash = "+" + hash_only.replace('/', "_").replace('+', '-')
final_hash = username + ":+" + hash_only.replace('/', "_").replace('+', '-')
return jsonify({'hash': final_hash})