Paul Rubin http://[EMAIL PROTECTED] wrote:
Hendrik van Rooyen [EMAIL PROTECTED] writes:
s = 'some string that needs a bcc appended'
ar = array.array('B',s)
bcc = 0
for x in ar[:]:
bcc ^= x
ar.append(bcc)
s=ar.tostring()
Untested:
import operator
s = 'some string that
Hendrik van Rooyen [EMAIL PROTECTED] writes:
s += chr(reduce(operator.xor, ar))
Yikes! - someday soon I am going to read the docs on what reduce does...
Reduce just intersperses an operator over a sequence. For example,
reduce(operator.add, (a,b,c,d,e))
is a+b+c+d+e.
Won't this be slow
Neil Cerutti wrote:
Woah! You better quadruple it instead.
How about Double Pig Latin?
No, wait! Use the feared UDPLUD code.
You go Ubbi Dubbi to Pig Latin, and then Ubbi Dubbi again.
Let's see here... Ubububythubububonubpubay
That's what I call ubububeautubububifubububulbubay.
That looks
Harlin Seritt wrote:
Hi...
I would like to take a string like 'supercalifragilisticexpialidocius'
and write it to a file in binary forms -- this way a user cannot read
the string in case they were try to open in something like ascii text
editor. I'd also like to be able to read the binary formed
Harlin Seritt kirjoitti:
Hi...
I would like to take a string like 'supercalifragilisticexpialidocius'
and write it to a file in binary forms -- this way a user cannot read
the string in case they were try to open in something like ascii text
editor. I'd also like to be able to read the
Grant Edwards [EMAIL PROTECTED] writes:
print base64.decodestring(open('sambleb.conf', 'r').read())
It'll only remain obfuscated for about 30 seconds after even a
mildly curious user looks at the file.
You could use the mult127 function, self-inverting like its better
known but more easily
On Wed, 21 Feb 2007 16:46:19 -0800, Harlin Seritt wrote:
WARNING: THIS IS NOT A STRONG ENCRYPTION ALGORITHM. It is just a
nuisance for someone that really wants to decrypt the string. But
it might work for your application.
-Larry
Thanks Larry! I was looking for something more beautiful
Steven D'Aprano kirjoitti:
On Wed, 21 Feb 2007 16:46:19 -0800, Harlin Seritt wrote:
WARNING: THIS IS NOT A STRONG ENCRYPTION ALGORITHM. It is just a
nuisance for someone that really wants to decrypt the string. But
it might work for your application.
-Larry
Thanks Larry! I was looking
On 2007-02-22, Jussi Salmela [EMAIL PROTECTED] wrote:
Steven D'Aprano kirjoitti:
On Wed, 21 Feb 2007 16:46:19 -0800, Harlin Seritt wrote:
WARNING: THIS IS NOT A STRONG ENCRYPTION ALGORITHM. It is just a
nuisance for someone that really wants to decrypt the string. But
it might work for
On 2007-02-22, Grant Edwards [EMAIL PROTECTED] wrote:
On 2007-02-22, Ganesan Rajagopal [EMAIL PROTECTED] wrote:
I am hoping to have it show up some weird un-readable text.
And then of course be able to convert it right back to a
string. Is this even possible?
Looks like you just want to
On Thu, 22 Feb 2007 11:55:22 +, Jussi Salmela wrote:
For extra security, you can encode the string with rot13 twice.
Like this? ;)
s = Python ; u = unicode(s, ascii) ; u
u'Python'
u.encode('rot13')
'Clguba'
u.encode('rot13').encode('rot13')
'Python'
Exactly! People
On Thu, 22 Feb 2007 08:18:07 +0200, Hendrik van Rooyen wrote:
I would xor each char in it with 'U' as a mild form of obfuscation...
I've often wished this would work.
'a' ^ 'U'
Traceback (most recent call last):
File stdin, line 1, in ?
TypeError: unsupported operand type(s) for ^: 'str'
Steven D'Aprano [EMAIL PROTECTED] writes:
Arrays don't support XOR any more than strings do. What's the advantage to
using the array module if you still have to jump through hoops to get it
to work?
It's a lot faster. Sometimes that matters.
--
On Thu, 22 Feb 2007 14:29:13 -0800, Paul Rubin wrote:
Steven D'Aprano [EMAIL PROTECTED] writes:
Arrays don't support XOR any more than strings do. What's the advantage to
using the array module if you still have to jump through hoops to get it
to work?
It's a lot faster. Sometimes that
Steven D'Aprano [EMAIL PROTECTED] writes:
For a short string like Python, using an array is a tiny bit slower, at
the cost of more complex code if you're converting a long string,
using array is faster. If it is a short string, it doesn't make much
difference.
I modified your array
Steven D'Aprano [EMAIL PROTECTED] wrote:
On Thu, 22 Feb 2007 08:18:07 +0200, Hendrik van Rooyen wrote:
I would xor each char in it with 'U' as a mild form of obfuscation...
I've often wished this would work.
'a' ^ 'U'
Traceback (most recent call last):
File stdin, line 1, in ?
Hendrik van Rooyen [EMAIL PROTECTED] writes:
s = 'some string that needs a bcc appended'
ar = array.array('B',s)
bcc = 0
for x in ar[:]:
bcc ^= x
ar.append(bcc)
s=ar.tostring()
Untested:
import operator
s = 'some string that needs a bcc appended'
ar = array.array('B',s)
s +=
Hi...
I would like to take a string like 'supercalifragilisticexpialidocius'
and write it to a file in binary forms -- this way a user cannot read
the string in case they were try to open in something like ascii text
editor. I'd also like to be able to read the binary formed data back
into string
Harlin Seritt wrote:
Hi...
I would like to take a string like 'supercalifragilisticexpialidocius'
and write it to a file in binary forms -- this way a user cannot read
the string in case they were try to open in something like ascii text
editor. I'd also like to be able to read the binary
On 2007-02-21, Harlin Seritt [EMAIL PROTECTED] wrote:
I would like to take a string like
'supercalifragilisticexpialidocius' and write it to a file in
binary forms -- this way a user cannot read the string in case
they were try to open in something like ascii text editor.
Why wouldn't they
Harlin Seritt wrote:
Hi...
I would like to take a string like 'supercalifragilisticexpialidocius'
and write it to a file in binary forms -- this way a user cannot read
the string in case they were try to open in something like ascii text
editor. I'd also like to be able to read the binary
On Feb 21, 7:02 pm, Colin J. Williams [EMAIL PROTECTED] wrote:
Harlin Seritt wrote:
Hi...
I would like to take a string like 'supercalifragilisticexpialidocius'
and write it to a file in binary forms -- this way a user cannot read
the string in case they were try to open in something
On Feb 21, 7:12 pm, Larry Bates [EMAIL PROTECTED] wrote:
Harlin Seritt wrote:
Hi...
I would like to take a string like 'supercalifragilisticexpialidocius'
and write it to a file in binary forms -- this way a user cannot read
the string in case they were try to open in something like
On Feb 21, 5:50 pm, Harlin Seritt [EMAIL PROTECTED] wrote:
Hi...
I would like to take a string like 'supercalifragilisticexpialidocius'
and write it to a file in binary forms -- this way a user cannot read
the string in case they were try to open in something like ascii text
editor. I'd also
On 2007-02-22, Harlin Seritt [EMAIL PROTECTED] wrote:
Try opening your file in the 'wb' mode.
I tried doing this:
text = 'supercalifragilisticexpialidocius'
open('sambleb.conf', 'wb').write(text)
Afterwards, I was able to successfully open the file with a text
editor and it showed:
Harlin == Harlin Seritt [EMAIL PROTECTED] writes:
I tried doing this:
text = 'supercalifragilisticexpialidocius'
open('sambleb.conf', 'wb').write(text)
Afterwards, I was able to successfully open the file with a text
editor and it showed:
'supercalifragilisticexpialidocius'
I am
On 2007-02-22, Ganesan Rajagopal [EMAIL PROTECTED] wrote:
I am hoping to have it show up some weird un-readable text.
And then of course be able to convert it right back to a
string. Is this even possible?
Looks like you just want to obfuscate the string. How about
this?
import base64
Grant Edwards [EMAIL PROTECTED] writes:
print base64.decodestring(open('sambleb.conf', 'r').read())
It'll only remain obfuscated for about 30 seconds after even a
mildly curious user looks at the file.
It depends on the requirement. If the intention is to just to
discourage someone with
Harlin Seritt [EMAIL PROTECTED] wrote:
Hi...
I would like to take a string like 'supercalifragilisticexpialidocius'
and write it to a file in binary forms -- this way a user cannot read
the string in case they were try to open in something like ascii text
editor. I'd also like to be able
29 matches
Mail list logo