在下面的代码中,连接是瓶颈.正如你所看到的,我已经尝试了一些复杂的方法来加快速度,但无论如何它的血腥都很慢.我想知道我能做些什么来使它紧固.
简单和秘密BTW是从二进制文件读取的数据,它们相当大(约1mb)
x = b''
if len(plain) < len(secret*8):
return False
i = 0
for secByte in secret:
for j in range(8):
z = setBit(plain[i],0,getBit(secByte,j))
#x += bytes([z])
x = x.join([b"", bytes([z])])
#x = array.array("B",(int(z) for z in x.join([b"", bytes([z])]))).tostring()
i = i+1
Run Code Online (Sandbox Code Playgroud) python ×1