Page 1 of 1

Didactic XOR

Posted: Thu Oct 16, 2008 1:39 am
by adum
dsaf

Posted: Wed Sep 14, 2011 5:17 pm
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

Posted: Wed Jan 04, 2012 2:15 pm
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

Posted: Fri May 04, 2012 11:33 am
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

Posted: Wed Jul 25, 2012 8:44 pm
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

Posted: Sun Mar 03, 2013 12:37 pm
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)

Posted: Mon Sep 16, 2013 5:37 pm
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 : ??

Posted: Wed Jan 13, 2016 2:36 am
by muffinman9
I solved this puzzle by hand ;-;