36 lines
1020 B
Python
36 lines
1020 B
Python
# Password verification test - we'll use Go to test this
|
|
|
|
# First, let's check if the database has the correct password
|
|
import sqlite3
|
|
import hashlib
|
|
|
|
conn = sqlite3.connect('d:/project/data/user_management.db')
|
|
c = conn.cursor()
|
|
|
|
# Get admin password hash
|
|
c.execute("SELECT password FROM users WHERE username = 'admin'")
|
|
row = c.fetchone()
|
|
if row:
|
|
stored_hash = row[0]
|
|
print(f"Stored hash length: {len(stored_hash)}")
|
|
print(f"Stored hash: {stored_hash[:80]}...")
|
|
|
|
# The hash format is: $argon2id$v=19$m=65536,t=3,p=2$<salt>$<hash>
|
|
parts = stored_hash.split('$')
|
|
print(f"\nHash parts:")
|
|
for i, part in enumerate(parts):
|
|
print(f" [{i}] {part[:50] if len(part) > 50 else part}")
|
|
|
|
# Extract parameters
|
|
params = parts[3].split(',')
|
|
print(f"\nParameters:")
|
|
for param in params:
|
|
print(f" {param}")
|
|
|
|
conn.close()
|
|
|
|
print("\n" + "="*50)
|
|
print("The password hash appears to be correct.")
|
|
print("The issue might be in the Go verification logic.")
|
|
print("="*50)
|