There is a bottleneck in the concatenation below. As you can see, I tried some complicated methods to speed it up, but its bloody slowdowns anyway. I would like to know if there is anything that I can do to make it fast.
By the way, both simple and secret are data read from a binary file, and they are quite large (about 1 mb)
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
source
share