Didactic XOR

Discussion of challenges you have already solved
Post Reply
User avatar
adum
Posts: 392
Joined: Thu Apr 19, 2007 12:49 pm
Contact:

Didactic XOR

Post by adum »

dsaf
Rbimas37
Posts: 1
Joined: Thu Sep 08, 2011 1:32 pm

Post by Rbimas37 »

Had no idea what this XOR business is all about at school. But now I do understand a bit, love this site :D
wynk
Posts: 7
Joined: Tue Jan 03, 2012 7:59 pm

Post by wynk »

My solution in ruby:

Code: Select all

input = ["9f", "c7"]
input.map! {
	|x| x.to_i(16)
}
output = input.first ^ input.last
puts output.chr
lortedy
Posts: 4
Joined: Thu May 03, 2012 9:49 pm

Post by lortedy »

Use "calc.exe" in Scientific mode. Select Hex as numeration base then XOR 9f with c7.
=> 58 which converted to ASCII = 'X'

Python:

Code: Select all

a = 0x9f
b = 0xc7
print chr(a^b)
=> X
meber
Posts: 1
Joined: Tue Jul 10, 2012 8:36 pm

Post by meber »

XOR -- this is Exclusive OR

Take your numbers
Convert to binary first on top of the second
Anywhere there is a 1 or 0 then it is a 1
Anywhere there is a 1 and 1 or 0 and 0 then it is a 0
derplumps
Posts: 3
Joined: Sun Mar 03, 2013 11:19 am

Post by derplumps »

wynk wrote:My solution in ruby:

Code: Select all

input = ["9f", "c7"]
input.map! {
	|x| x.to_i(16)
}
output = input.first ^ input.last
puts output.chr
Python is faster:

Code: Select all

"%c"%(0x9f ^ 0xc7)
User avatar
akitta
Posts: 1
Joined: Tue Sep 10, 2013 9:36 pm
Location: WESTERN-EUROPE

Post by akitta »

lortedy wrote:Use "calc.exe" in Scientific mode. Select Hex as numeration base then XOR 9f with c7.
=> 58 which converted to ASCII = 'X'

Python:

Code: Select all

a = 0x9f
b = 0xc7
print chr(a^b)
=> X
I don't know if i missed something here, But I used the same method 'calc.exe'
I got 58 but in ascii 58 = :
so i tried : and it was a error.
I converted it to .decimal and it was 88(x)
Which worked.
So isn't 58 on ascii table this symbol : ??
The first principle is that you must not fool yourself - and you are the easiest person to fool.
muffinman9
Posts: 1
Joined: Mon Jan 11, 2016 9:49 pm

Post by muffinman9 »

I solved this puzzle by hand ;-;
Post Reply