[Tutor] string to binary and back... Python 3

Jordan wolfrage8765 at gmail.com
Thu Jul 19 22:40:06 CEST 2012



On 07/19/2012 09:53 PM, Dave Angel wrote:
> On 07/19/2012 03:19 PM, Jordan wrote:
>> <SNIP>
>>
>> OK. I am using one time pads to XOR data, but the one time pads (keys)
>> are very large numbers, converting them to binary increases their size
>> exponentially, which allows me to get more XORing done out of a single
> You want to explain this impossibility of increasing size
> exponentially?  If you're wanting to waste memory, there are better
> ways.  But it's only 8 times as big to save a string of 1's and zeros as
> to save the large-int they represent.  And multiplying by 8 isn't an
> exponential function.
>
Yes if you wish to dissect my words the wrong word was chosen...
>> key. I am XORing both files and strings so I need to have code that can
>> do both even if that means two branches of code via an if/else perhaps
>> with an isinstance(data, str).
>> I do not need to actually see the binary form.
>>
> Then don't use the binary form.  It doesn't make the computation any
> more "powerful" and it'll certainly slow it down.
The title of the question is string to binary and back.
>
> Are you trying to match some other program's algorithm, and thus have
> strange constraints on your data?  Or are you simply trying to make a
> secure way to encrypt binary files, using one-time pads?
I already answered this question...
>
> A one-time pad is the same size as the message, so you simply need to
> convert the message into a large-int, and xor them.
>
>


More information about the Tutor mailing list