Added username field for argon2copyparty only
This commit is contained in:
5
app.py
5
app.py
@@ -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})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user