2024-10-18 00:19:39 +00:00
|
|
|
import random
|
2024-10-18 00:57:39 +00:00
|
|
|
import string
|
2024-10-18 00:19:39 +00:00
|
|
|
|
2024-10-18 01:17:26 +00:00
|
|
|
def generate_salt():
|
|
|
|
# Ensure the first character after "SALT" is a lowercase letter
|
|
|
|
first_char = random.choice(string.ascii_lowercase)
|
|
|
|
# Generate the remaining characters (11 more to make a total of 16)
|
|
|
|
remaining_chars = ''.join(random.choices(string.ascii_letters + string.digits, k=11))
|
|
|
|
return 'SALT' + first_char + remaining_chars
|
2024-10-18 00:19:39 +00:00
|
|
|
|
2024-10-18 00:57:39 +00:00
|
|
|
def generate_proof_of_work():
|
2024-10-18 01:12:16 +00:00
|
|
|
# Set fixed memory cost and difficulty
|
|
|
|
memory_cost = 262144
|
2024-10-18 00:57:39 +00:00
|
|
|
time_cost = 1 # Always set to 1
|
|
|
|
salt = generate_salt()
|
2024-10-18 01:12:16 +00:00
|
|
|
difficulty = 1500
|
2024-10-18 00:57:39 +00:00
|
|
|
|
|
|
|
# Format the challenge code
|
|
|
|
proof_of_work_code = f"{memory_cost}:{time_cost}:{salt}:{difficulty}"
|
|
|
|
print(f"Generated Proof of Work Code: {proof_of_work_code}")
|
2024-10-18 00:19:39 +00:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2024-10-18 00:57:39 +00:00
|
|
|
generate_proof_of_work()
|