@pieromqwerty/

UTF Encoding Test

Python

No description

fork
loading
Files
  • main.py
  • requirements.txt
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
def dec(key_enc):
	key_dec = int(key_enc, 16)
	return key_dec

def enc(key_dec):
	key_enc = hex(key_dec)
	return key_enc

def ens_len(string, length):
	while len(string) < length:
		string = "0" + string
	return string

keya = 00000000
keyb = 0000
keyc = 0000
keyd = 0000
keye = 000000000000

keye = keye + 1
if int(len(enc(keye)) > 14):
	keyd = keyd + 1
	keye = keye - 1
	if int(len(enc(keyd)) > 6):
		keyc = keyc + 1
		keyd = keyd - 1
		if int(len(enc(keyc)) > 6):
			keyb = keyb + 1
			keyc = keyc - 1
			if int(len(enc(keyb)) > 6):
				keya = keya + 1
				keyb = keyb - 1
				if int(len(enc(keya)) > 8):
					keya = 00000000
					keyb = 0000
					keyc = 0000
					keyd = 0000
					keye = 000000000000

keya = ens_len(enc(keya)[2:], 8)
keyb = ens_len(enc(keyb)[2:], 4)
keyc = ens_len(enc(keyc)[2:], 4)
keyd = ens_len(enc(keyd)[2:], 4)
keye = ens_len(enc(keye)[2:], 12)

key_final = "Key " + str(keya) + "-" + str(keyb) + "-" + str(keyc) + "-" + str(keyd) + "-" + str(keye)

print(key_final)