CompetitiveProgramming/src/bin/test.py

26 lines
618 B
Python
Raw Normal View History

2024-02-27 03:42:51 +00:00
import hashlib
def generateLicense(email):
array = []
hashObject = hashlib.md5(email.encode('utf-8'))
hexDigest = hashObject.hexdigest()
for i in range(0, len(hexDigest),5):
if i < 21:
flag = hexDigest[i:i + 5]
array.append(flag)
2024-01-18 04:40:12 +00:00
else:
2024-02-27 03:42:51 +00:00
pass
licenseKey = '-'.join(array)
return licenseKey
if __name__ == '__main__':
emailInput = input('请输入Email:')
licenseKey = generateLicense(emailInput)
listen = '{\n "email" : "' +str(emailInput) + '",\n "license_key" : "' + format(licenseKey) + '"\n}'
print(listen)