21 lines
415 B
Python
21 lines
415 B
Python
import random
|
|
|
|
def generate_key(nonce: int):
|
|
def fmt(x):
|
|
return "{:04x}".format(x)
|
|
|
|
a = 65536 % nonce
|
|
b = 65536 % (65536 - nonce)
|
|
|
|
c = a ^ b
|
|
key = ["SHTP"]
|
|
key.append(fmt(a))
|
|
key.append(fmt(b))
|
|
key.append(fmt(c))
|
|
|
|
print('-'.join(key))
|
|
|
|
generate_key(random.randint(256, 65536-256))
|
|
generate_key(random.randint(256, 65536-256))
|
|
generate_key(random.randint(256, 65536-256))
|