Hey everybody welcome to the next video.
So in this video are we going over big operators so bid operators some of these are called and or not
an XOR.
Now these are commonly known as logic gates and can perform some unique operations on bits on a quick
fashion.
Now this is commonly used with assembly and some even higher level languages such as Python C Java when
required working with working at the bit level.
Now this is commonly done to hold mass amounts of value in data into us into bits individually so turning
things on and off can be done at the bit level rather than having a full boolean or a variable holding
a specific value now the end operator.
Now when.
When bits are compared with two bit sets if they're both one then the result is one if they're not both
one then the result is zero.
So we can see here 0 1 0 0 0 and 1 0 1 and one is 1 and then 1 and 0 0.
So you can see how the end only works and only sets it to 1.
If they are both one now with or when the bit sets are compared if any of them are one then the result
is 1.
Otherwise the result is zero.
So you can see here's or 0 or 0 0 0 or 1 is 1 1 or 1 it's 1 1 or 0 is 1.
So this is a good way to to turn on a lot of bits when any when the two comparisons have a lot of bits
set already.
Then we have the not operator so this compares.
It's essentially a flip so it flips things from if it was set to zero it's now one if it's one it was
set to zero.
Now this is only done in one bit set at a time so you're not going to have to hear.
You'd have to run a not on the next bit set to change it.
So in this case not 0 is 1 not 0 is one not one is zero.
So it just flips the bit from what we already currently have.
The last one is XOR or exclusive or.
Now if both bits match then the result is zero.
If there is a one set then the value is 1.
Otherwise it's 0 so 0 0 0 x Saucier 0 0 0 x XOR 1 is 1 1 x or 1 0 1 x or 0 is 1.
Now what's important understand here is in sometimes in the shell code when generating your own shell
code or when you're working with exploits you're going to find yourself in a character restricted set.
So in most exploit you can't use a no operator of 0.
So when you're trying to set a register to 0 to reset the value or to work with it you can't do move
X comma 0 0.
That won't work because it's considered a null terminator so the shell code will stop prematurely from
running what you can do as you can XOR both the register with itself.
Because if both pitch match and the results 0.
So if I X sawed this top bit set with the same bit set so 0 0 0 x or 0 then it would be 0 extra 0 1
x or 1 0 and you can see how it just zeroes out the hole register.
So it's important to understand bit operators and understand where they're used and what they can kind
of do.
So when you see it in assembly you can kind of get an idea of what they're doing.