Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #93229 > unrolled thread
| Started by | Peter Otten <__peter__@web.de> |
|---|---|
| First post | 2015-06-27 10:29 +0200 |
| Last post | 2015-06-27 10:29 +0200 |
| 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.
Re: Pure Python Data Mangling or Encrypting Peter Otten <__peter__@web.de> - 2015-06-27 10:29 +0200
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Date | 2015-06-27 10:29 +0200 |
| Subject | Re: Pure Python Data Mangling or Encrypting |
| Message-ID | <mailman.129.1435393759.3674.python-list@python.org> |
Randall Smith wrote:
> Chunks of data (about 2MB) are to be stored on machines using a
> peer-to-peer protocol. The recipient of these chunks can't assume that
> the payload is benign. While the data senders are supposed to encrypt
> data, that's not guaranteed, and I'd like to protect the recipient
> against exposure to nefarious data by mangling or encrypting the data
> before it is written to disk.
>
> My original idea was for the recipient to encrypt using AES. But I want
> to keep this software pure Python "batteries included" and not require
> installation of other platform-dependent software. Pure Python AES and
> even DES are just way too slow. I don't know that I really need
> encryption here, but some type of fast mangling algorithm where a bad
> actor sending a payload can't guess the output ahead of time.
>
> Any ideas are appreciated. Thanks.
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.
Back to top | Article view | comp.lang.python
csiph-web