Search Tools Links Login

An Xor explanation


Visual Basic 6, or VB Classic

A simple guide to understanding Xor.

Original Author: DMJefff

Code

What is Xor? This article will tell you why 10 Xor 12 is 6 and other stuff like that so anyway. Lets just start simple. Xor is done in binary so, the first step would be to convert the numbers into binary. 10 in binary is 1010 and 12 in binary is 1100. This can be figured out by using the windows calculator. (I'll save counting in binary and binary conversions for the next article.) So how does 1010 Xor 1100 = 6? The simplest way to do this would be to write the up and down like you were about to add them.
1010
1100
OK. Now Xoring (whatever) them is real simple. Just add them, but when ever you see a 2 write 0 instead. So,
1010
1100 =
0110
Simple, yes! 110 (you can remove 0's at the beggining) in decimal is 6! One last thing worth mentioning is if there arn't enough digits in a number count them as 0's. For example:
1101
110 =
1011
You count the blank spaces as 0's. This is my first article so please comment!

About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 118 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.