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


Groups > comp.lang.python > #93256 > unrolled thread

Re: Pure Python Data Mangling or Encrypting

Started byRandall Smith <randall@tnr.cc>
First post2015-06-27 13:17 -0500
Last post2015-06-27 13:17 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#93256 — Re: Pure Python Data Mangling or Encrypting

FromRandall Smith <randall@tnr.cc>
Date2015-06-27 13:17 -0500
SubjectRe: Pure Python Data Mangling or Encrypting
Message-ID<mailman.142.1435429051.3674.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web