Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Bitwise Operators - TT&^/TT

by TheoPetersen (Priest)
on Jul 25, 2001 at 00:55 UTC ( [id://99482]=note: print w/replies, xml ) Need Help??


in reply to Bitwise Operators - &^

but when 155 and 105 are XORed, that produces 240, not 242.

Says who? The exclusive or of two bit patterns contains a one for each mismatch pair of bits and a zero for each matched pair. Thus for 155 and 105:

# 1001 1011 - 155 # 0110 1001 - 105 # 1111 0010 - 242
The fun thing about XOR is that if you XOR the result with one of the input values, you get the other input value back:
# 1001 1011 - 155 # 1111 0010 - 242 # 0110 1001 - 105
Thus various encryption schemes (and some fun graphics programming on early PCs :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://99482]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-24 22:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found