在下面的代码中,串联是瓶颈。
正如您所看到的,我已经尝试了一些复杂的方法来加速它,但无论如何它都非常慢。我想知道是否有任何方法可以使它更快。
顺便说一句,plain和secret都是从二进制文件中读取的数据,它们相当大(约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