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():
|
2024-10-18 01:42:36 +00:00
|
|
|
# Generate the salt in the specified format
|
|
|
|
first_letter = random.choice(string.ascii_lowercase)
|
|
|
|
first_number = random.choice(string.digits)
|
|
|
|
second_letter = random.choice(string.ascii_lowercase)
|
|
|
|
three_numbers1 = ''.join(random.choices(string.digits, k=3))
|
|
|
|
third_letter = random.choice(string.ascii_lowercase)
|
|
|
|
second_number = random.choice(string.digits)
|
|
|
|
fourth_letter = random.choice(string.ascii_lowercase)
|
|
|
|
three_numbers2 = ''.join(random.choices(string.digits, k=3))
|
|
|
|
|
|
|
|
# Combine to form the salt
|
|
|
|
salt = f"SALT{first_letter}{first_number}{second_letter}{three_numbers1}{third_letter}{second_number}{fourth_letter}{three_numbers2}"
|
|
|
|
return salt
|
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}"
|
2024-10-18 01:38:05 +00:00
|
|
|
return proof_of_work_code
|
2024-10-18 00:19:39 +00:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2024-10-18 01:38:05 +00:00
|
|
|
result = generate_proof_of_work()
|
|
|
|
print(f"Generated Proof of Work Code: {result}")
|