Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #106956
| From | alister <alister.ware@ntlworld.com> |
|---|---|
| Subject | Re: How to XOR a byte output? |
| Newsgroups | comp.lang.python |
| References | <387506b1-b645-4907-a45c-81a8c3043099@googlegroups.com> |
| Message-ID | <AguPy.838728$hz.468617@fx42.am4> (permalink) |
| Organization | virginmedia.com |
| Date | 2016-04-13 16:15 +0000 |
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 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.
>
correct it is a string o bytes & bytes that do not have a dispalyable
ASCI character are shown using the \x<hex> format
> I saw many \x and thought it might be hex.
>
>
> So, I used binascii.hexlify() and got the following output:
> b'242f2f573fc08239a2b9138cd57b'
>
> Now, this output is being encrypted and I need to perform an XOR
> operation on it in order to retrieve a secret message.
>
No you ned to perform the Xor operation on the original bytes hexifying
the string will not help you (it will actual make the situation worse)
> But, I'm not sure how to code the XOR operation. How do I code that?
without completing your homework for you, the principle is
step through each byte in turn
perform the XOR function
add the result to a new byte string.
if you are using the correct xor value hopefully you will get a readable
output.
>
> Thank you.
>
> PS: I'm not sure if I have done any mistake along the way. That's why I
> have mentioned all the steps that I've done. Let me know if I have done
> any step wrongly. :)
indeed this has been better written than most homework assistance
requests posted here that simply want a solution, but mentioning it is
homework would be better still.
--
Don't let your status become too quo!
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to XOR a byte output? durgadevi1 <srirajarajeswaridevikrupa@gmail.com> - 2016-04-13 06:18 -0700
Re: How to XOR a byte output? Chris Angelico <rosuav@gmail.com> - 2016-04-13 23:29 +1000
Re: How to XOR a byte output? durgadevi1 <srirajarajeswaridevikrupa@gmail.com> - 2016-04-13 06:51 -0700
Re: How to XOR a byte output? Chris Angelico <rosuav@gmail.com> - 2016-04-14 00:31 +1000
Re: How to XOR a byte output? Stephen Hansen <me+python@ixokai.io> - 2016-04-13 08:33 -0700
Re: How to XOR a byte output? Marko Rauhamaa <marko@pacujo.net> - 2016-04-13 17:27 +0300
Re: How to XOR a byte output? Ian Kelly <ian.g.kelly@gmail.com> - 2016-04-13 09:30 -0600
Re: How to XOR a byte output? durgadevi1 <srirajarajeswaridevikrupa@gmail.com> - 2016-04-14 01:49 -0700
Re: How to XOR a byte output? Peter Otten <__peter__@web.de> - 2016-04-14 11:16 +0200
Re: How to XOR a byte output? Marko Rauhamaa <marko@pacujo.net> - 2016-04-14 12:18 +0300
Re: How to XOR a byte output? Chris Juried <cjuried@yahoo.com> - 2016-04-14 23:05 +0000
Re: How to XOR a byte output? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-04-15 08:06 -0400
Re: How to XOR a byte output? alister <alister.ware@ntlworld.com> - 2016-04-13 16:15 +0000
[OT] A doubt about a doubt, was Re: How to XOR a byte output? Peter Otten <__peter__@web.de> - 2016-04-13 18:59 +0200
Re: [OT] A doubt about a doubt, was Re: How to XOR a byte output? Rustom Mody <rustompmody@gmail.com> - 2016-04-13 18:54 -0700
Re: [OT] A doubt about a doubt Peter Otten <__peter__@web.de> - 2016-04-14 14:26 +0200
Re: How to XOR a byte output? durgadevi1 <srirajarajeswaridevikrupa@gmail.com> - 2016-04-14 01:32 -0700
Re: How to XOR a byte output? durgadevi1 <srirajarajeswaridevikrupa@gmail.com> - 2016-04-15 04:46 -0700
csiph-web