paint-brush
Change Your Codes Behavior By Using Bitwise Operatorsby@silver.io
753 reads
753 reads

Change Your Codes Behavior By Using Bitwise Operators

by silver.io3mFebruary 20th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

The program prints the binary representation of different access mode flags that are used in the open() function. The flags have “values that correspond to single bits”, (Hacking: The Art of Exploitation, Jon Erickson) and consequently, the flags can be added together (using the OR operator) to create new behavior. We use a bit mask (the mask) with a value of 4278190080 (this number requires four bytes) to isolate each byte. The outer loop runs four times — and is in charge of isolating each byte and checking if the msb (most significant bit) is set.

Company Mentioned

Mention Thumbnail
featured image - Change Your Codes Behavior By Using Bitwise Operators
silver.io HackerNoon profile picture
silver.io

silver.io

@silver.io

Engineering, hacking, surfing

About @silver.io
LEARN MORE ABOUT @SILVER.IO'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

silver.io HackerNoon profile picture
silver.io@silver.io
Engineering, hacking, surfing

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite
Joyk
Coffee-web
Prodsens
Owlver
Owlver
Style-tricks
Tefter
Tefter