MemoryError in data conversion

Mok-Kong Shen mok-kong.shen at t-online.de
Mon Apr 14 08:26:31 EDT 2014


Am 14.04.2014 09:46, schrieb Peter Otten:

> You ran into a limitation of the compiler. For us to suggest a workaround
> you'd have to explain why you want to convert the list returned from
> buildhuffmantree() into python source code and back.

That list gives the Huffman encoding tree for compressing a given piece
of source text. I am writing a Python code to implement an algorithm
(not new, being first sketched in the literature since decades but yet
having no publically available implementation as far as I am aware) of
encryption processing that has Huffman data compression as its major
constituent. Now, for good security against cryptanalysis, this list
(which has to be included in the ciphertext for decryption by the
recipient) has to be well scrambled in some way. I choose to use 8-bit
bytes as units for the scrambling. Hence I convert the list to a
bytearray for performing scrambling. On decryption I reverse the
scrambling and get back the original bytearray and use ast to recover
from it the list so as to be able to do the decompression. Hopefully
this description is sufficiently clear.

M. K. Shen





More information about the Python-list mailing list