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


Groups > comp.lang.python > #93256

Re: Pure Python Data Mangling or Encrypting

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'sufficient': 0.05; 'chunk': 0.07; 'block.': 0.09; 'effect.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'def': 0.14; 'dest)': 0.16; 'discussion.': 0.16; 'prepend': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'wrote:': 0.16; 'translation': 0.16; 'byte': 0.18; 'say,': 0.18; 'strip': 0.22; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'header :User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'block,': 0.29; 'calculated': 0.29; 'table,': 0.29; 'random': 0.29; 'table': 0.32; 'received:comcast.net': 0.33; 'running': 0.34; 'to:addr :python-list': 0.35; 'skip:o 20': 0.35; 'subject:: ': 0.37; 'received:org': 0.38; 'to:addr:python.org': 0.39; 'data': 0.40; 'skip:u 10': 0.62; 'side': 0.62; 'charset:windows-1252': 0.65; 'subject:Data': 0.66; 'otten': 0.84; 'random,': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Randall Smith <randall@tnr.cc>
Subject Re: Pure Python Data Mangling or Encrypting
Date Sat, 27 Jun 2015 13:17:09 -0500
References <mmcagn$aa5$1@ger.gmane.org> <mmlmsk$m2e$1@ger.gmane.org>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host c-98-251-140-107.hsd1.ms.comcast.net
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
In-Reply-To <mmlmsk$m2e$1@ger.gmane.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.142.1435429051.3674.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1435429051 news.xs4all.nl 2962 [2001:888:2000:d::a6]:47668
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:93256

Show key headers only | 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