Re: How to XOR a byte output?

2016-04-15 Thread durgadevi1
On Wednesday, April 13, 2016 at 9:18:37 PM UTC+8, durgadevi1 wrote: > Hi all, > > I have a doubt regarding a problem. > > First, I am required to read a given file. > > > The output from the file is given below: > > b'$//W?\xc0\x829\xa2\xb9\x13\x8c\xd5{\' > > > I used the type() to identify

Re: How to XOR a byte output?

2016-04-14 Thread Chris Juried via Python-list
Hello list, I am new to the list and was wondering if anyone is using Python for MCU programing? In particular the AVR and ARM based controllers. Is Python a plausible language for MCU programming or is C/C++ or Assembly the only way to go? Thanks in advance for your insight.  Sincerely,      Ch

Re: How to XOR a byte output?

2016-04-14 Thread Marko Rauhamaa
durgadevi1 : >>>>> bytes(c ^ k for c, k in zip(code, key)).decode() > > [...] > UnicodeDecodeError: 'utf-8' codec can't decode byte 0x85 in position 0: > invalid start byte > > [...] > > However, I get no errors when using values 0 to 127 to XOR with CODE. > But I get errors when using values

Re: How to XOR a byte output?

2016-04-14 Thread Peter Otten
durgadevi1 wrote: > >> >> This looks clearer: >> >>>>> code = b'a0\xed\xf0Z\x15]g^\xce3x' >>>>> key = b')U\x81\x9c55*\x08,\xa2WY' >>>>> bytes(c ^ k for c, k in zip(code, key)).decode() >>'Hello world!' >> >> >> Marko > > Hi, I have gotten another error message when working wi

Re: How to XOR a byte output?

2016-04-14 Thread durgadevi1
> > This looks clearer: > >>>> code = b'a0\xed\xf0Z\x15]g^\xce3x' >>>> key = b')U\x81\x9c55*\x08,\xa2WY' >>>> bytes(c ^ k for c, k in zip(code, key)).decode() >'Hello world!' > > > Marko Hi, I have gotten another error message when working with the bytes(c ^ k for c, k in zip

Re: How to XOR a byte output?

2016-04-14 Thread durgadevi1
On Wednesday, April 13, 2016 at 9:18:37 PM UTC+8, durgadevi1 wrote: > Hi all, > > I have a doubt regarding a problem. > > First, I am required to read a given file. > > > The output from the file is given below: > > b'$//W?\xc0\x829\xa2\xb9\x13\x8c\xd5{\' > > > I used the type() to identify

Re: [OT] A doubt about a doubt, was Re: How to XOR a byte output?

2016-04-13 Thread Rustom Mody
On Wednesday, April 13, 2016 at 10:30:07 PM UTC+5:30, Peter Otten wrote: > alister wrote: > > > On Wed, 13 Apr 2016 06:18:22 -0700, durgadevi1 wrote: > > > >> I have a doubt regarding a problem. > >> > > No, you have a question doubt means you don't believe something > > (sorry I know this is no

[OT] A doubt about a doubt, was Re: How to XOR a byte output?

2016-04-13 Thread Peter Otten
alister wrote: > On Wed, 13 Apr 2016 06:18:22 -0700, durgadevi1 wrote: > >> I have a doubt regarding a problem. >> > No, you have a question doubt means you don't believe something > (sorry I know this is not an English language lesson) "doubt" is commonly used that way in Indian English, see

English dialect (Was: How to XOR a byte output?)

2016-04-13 Thread Ian Kelly
On Wed, Apr 13, 2016 at 10:15 AM, alister wrote: > On Wed, 13 Apr 2016 06:18:22 -0700, durgadevi1 wrote: > >> Hi all, >> >> I have a doubt regarding a problem. >> > No, you have a question doubt means you don't believe something > (sorry I know this is not an English language lesson) No, this is

Re: How to XOR a byte output?

2016-04-13 Thread alister
On Wed, 13 Apr 2016 06:18:22 -0700, durgadevi1 wrote: > Hi all, > > I have a doubt regarding a problem. > No, you have a question doubt means you don't believe something (sorry I know this is not an English language lesson) > First, I am required to read a given file. > > > The output from t

Re: How to XOR a byte output?

2016-04-13 Thread Stephen Hansen
On Wed, Apr 13, 2016, at 06:51 AM, durgadevi1 wrote: > I would like to check with you whether using binascii.hexlify() to > convert the series of bytes into alphabets and integers is correct. To be clear, they already are integers.The \x notation is how you naively represent a byte out of the prin

Re: How to XOR a byte output?

2016-04-13 Thread Ian Kelly
On Wed, Apr 13, 2016 at 8:27 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> Let's just guess that you want to xor with the byte value 0xAA. We can >> do that fairly simply, using integer operations. >> > data = b'$//W?\xc0\x829\xa2\xb9\x13\x8c\xd5{\\' > bytes(b ^ 0xAA for b in data) >>

Re: How to XOR a byte output?

2016-04-13 Thread Chris Angelico
On Wed, Apr 13, 2016 at 11:51 PM, durgadevi1 wrote: > Ok thank you ChrisA. :) > > I would like to check with you whether using binascii.hexlify() to convert > the series of bytes into alphabets and integers is correct. It converts the bytes (which are small integers) into the hexadecimal represe

Re: How to XOR a byte output?

2016-04-13 Thread Marko Rauhamaa
Chris Angelico : > Let's just guess that you want to xor with the byte value 0xAA. We can > do that fairly simply, using integer operations. > data = b'$//W?\xc0\x829\xa2\xb9\x13\x8c\xd5{\\' bytes(b ^ 0xAA for b in data) > b'\x8e\x85\x85\xfd\x95j(\x93\x08\x13\xb9&\x7f\xd1\xf6' > > Well,

Re: How to XOR a byte output?

2016-04-13 Thread durgadevi1
On Wednesday, April 13, 2016 at 9:29:45 PM UTC+8, Chris Angelico wrote: > On Wed, Apr 13, 2016 at 11:18 PM, durgadevi1 > wrote: > > > > The output from the file is given below: > > > > b'$//W?\xc0\x829\xa2\xb9\x13\x8c\xd5{\' > > > > > > I used the type() to identify the class and its a byte class.

Re: How to XOR a byte output?

2016-04-13 Thread Chris Angelico
On Wed, Apr 13, 2016 at 11:18 PM, durgadevi1 wrote: > > The output from the file is given below: > > b'$//W?\xc0\x829\xa2\xb9\x13\x8c\xd5{\' > > > I used the type() to identify the class and its a byte class. > > I saw many \x and thought it might be hex. > > > So, I used binascii.hexlify() and go

How to XOR a byte output?

2016-04-13 Thread durgadevi1
Hi all, I have a doubt regarding a problem. First, I am required to read a given file. The output from the file is given below: b'$//W?\xc0\x829\xa2\xb9\x13\x8c\xd5{\' I used the type() to identify the class and its a byte class. I saw many \x and thought it might be hex. So, I used bina