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

Prasad, Ramit ramit.prasad at jpmorgan.com
Thu Jul 19 22:48:29 CEST 2012


> >> <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...

Yes, you stated that it had to work on string and files, but are the 
files binary? DaveA and I are asking the questions because given
what you are asking it just seems like you are not using the Right
approach. I can touch my nose by touching my nose with my hand, 
or asking the person next to me to pick up my hand and use it to
touch my nose. Both work, one is just faster and easier to
understand.

> >
> > 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.

Ramit
This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  


More information about the Tutor mailing list