On 06/27/2015 03:29 AM, Peter Otten wrote:
Would it be sufficient to prepend the chunk with one block, say, of random data? To unmangle you'd just strip off that block. BLOCK = os.urandom(BLOCKSIZE) def mangle(source, dest): dest.write(BLOCK) shutil.copyfileobj(source, dest) def unmangle(source, dest): source.read(BLOCKSIZE) shutil.copyfileobj(source, dest) Disclaimer: I did not follow the ongoing discussion.
That is happening as a side effect. Though not completely random, after running the data through a translation table, the 256 byte table is prepended. Then a 4 byte checksum is calculated and prepended.
-Randall -- https://mail.python.org/mailman/listinfo/python-list