Created
June 10, 2022 00:31
-
-
Save xja/7b3d1db1723f11c433c4706c8408a999 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint | |
rn = [randint(0, 255) for _ in range(14)] | |
rn[1] = 0xE7 | |
rn[5] = 0x03 | |
arg2 = [0xc, 6] | |
arg3 = [3, 0xf3] | |
for i in range(2): | |
a1 = 0 | |
for j in range(4): | |
a1 <<= 8 | |
a1 += rn[i * 4 + j] | |
rn[9+3*i] = ((a1 >> arg2[i]) & 0xff) ^ ((a1 & 0xff) | arg3[i]) | |
rs = '' | |
for i in range(14): | |
rs += f'{rn[i]:02X}' | |
if i % 2: | |
rs += '-' | |
cx = 0x42 | |
dx = 0xBE | |
for s in rs: | |
if s != '-': | |
dx += ord(s) | |
if dx > 0xFF: | |
dx -= 0xFF | |
cx += dx | |
if cx > 0xFF: | |
cx -= 0xFF | |
rs += f'{cx:02X}{dx:02X}' | |
print(rs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment