Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #93256

Re: Pure Python Data Mangling or Encrypting

From Randall Smith <randall@tnr.cc>
Subject Re: Pure Python Data Mangling or Encrypting
Date 2015-06-27 13:17 -0500
References <mmcagn$aa5$1@ger.gmane.org> <mmlmsk$m2e$1@ger.gmane.org>
Newsgroups comp.lang.python
Message-ID <mailman.142.1435429051.3674.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Pure Python Data Mangling or Encrypting Randall Smith <randall@tnr.cc> - 2015-06-27 13:17 -0500

csiph-web