Boolean algebra or bitwise operations are necessary in low-level programming since it can perform simple calculations by changing the bits of a number. It is commonly used in cryptography's obfuscation and decoding.
NOT
This operation reverses the bits.
Consider the following as an example: NOT AL
If AL equals 1010101b (55h), it becomes 10101010b (AAh).
AND
This operation sets bit to 1 if both are 1s, otherwise it sets bit to 0.
Consider the following as an example: AND AL, AH
If AL equals 10111010b (BAh) and AH equals 11101101b (EDh), AL becomes 10101000b (A8h).
OR
This operation sets bit to 0 if both are 0s, else it sets bit to 1.
Consider the following as an example: OR AL, AH
If AL equals 10111010b (BAh) and AH equals 11101100b (ECh), AL becomes 11111110b (FEh).
XOR
This operation sets bit to 0 if both bits are equal, else it sets bit to 1.
Consider the following as an example: XOR EAX, EAX
XOR-ing the same value will become 0. Thus EAX becomes 0:
XOR AH, AL
If AH were 100010b (22h) and AL were 1101011b (6Bh), AH becomes 1001001b (49h).
SHL/SAL
This operation shifts bits to the left.
Consider the following as an example: SHL AL, 3
If AL were 11011101b (DDh), shifting it to the left by 3 makes AL equal to 11101000b (E8h).
SHR/SAR
This operation shifts bits to the right.
Consider the following as an example: SHR AL, 3
If AL were 11011101b (DDh), shifting it to the right by 3 makes AL equal to 011011b (1Bh).
ROL
This operation rotates bits to the left.
Consider the following as an example: ROL AL, 3
if AL were 11011101b (DDh), rotating it to the left by 3 makes AL equal to 11101110b (EEh).
ROR
This operation rotates bits to the right.
Consider the following as an example: ROR AL, 3
If AL were 11011101b (DDh), rotating it to the right by 3 makes AL equal to 10111011b (BBh).