In message <[EMAIL PROTECTED]>, Michele wrote: > class Encoder(object): > def create_random_block(self, data, seed, blocksize): > number_of_blocks = int(len(data)/blocksize) > random.seed(seed) > random_block = ['0'] * blocksize > for index in range(number_of_blocks): > if int(random.getrandbits(1)) == 1: > block = data[blocksize*index:blocksize*index+blocksize] > for bit in range(len(block)): > random_block[bit] = > chr(ord(random_block[bit])^ord(block[bit])) # workaround per fare xor > bit a bit di str; xor e' solo supportato per int -> ord > return ''.join(random_block)
OK, this function is randomly choosing blocks from data (of length number_of_blocks * blocksize), and xoring them together to produce a single block of length blocksize. > piece = os.urandom(1024*1024) Is piece really meant to be random? If so, your create_random_block function isn't achieving much--xoring random data together isn't going to produce anything more exciting than less random data than you started with. -- http://mail.python.org/mailman/listinfo/python-list