Now that you have the basic idea of steganography,

it's time to learn a bit about binary.

So you can do the math on the numeric values of pixels.

Let's start with a refresher on base ten numbers,

the normal decimal system you use everyday.

In a base ten number, the digits are in the 1s place, the 10s place,

the 100s place, and so on.

This means that a number like 8,237 is

7*1 plus 3*10 plus 2*100 plus 8*1000.

The same principles apply in binary but

the places are powers of two instead of powers of ten.

Computers do this because they fundamentally work with electric circuits

and transistors which are easiest to implement with two voltage levels.

So, computers work naturally in a number system where you have only two values,

ones and zeros.

So the binary number 10111,

one is 1 * 1 plus 1 * 2 plus 1 * 4

plus 0 * 8 plus 1 * 16, which,

if you wrote in decimal, would be 23.

The red, green, and blue components of pixels range from 0 to 255

because they are stored with eight binary digits called bits.

Note that the b in bit comes from binary, and the it in bit comes from digit.

With eight digits, or eight bits,

a number can range from 0000 0000,

which is the decimal number 0,

to 1111 1111, which is decimal 255.

These eight bits are in the 1's place,

the 2's place, and so on up through the 128's place.

If you were to add up all these place values, you would get 255.

Now that you know that each color is an eightbit binary number,

let's revisit this steganography problem.

You want to hide the eight-bit number on the left,

10110010 in the number on the right, 01110101.

As before, you'll hide the most significant digits.

In this case,

you use the four digits from each number, since that's half of the total digits.

The resulting number would be this eight bit binary number, where we've colored

the bits based on which of the two original numbers they came from.

The most significant bits from the number you want to hide shown in blue

are now hidden as the least significant bits of the color that will be displayed.

That's how you do it conceptually, but

how do you pull these numbers apart and then put them back together using

mathematical operations that you can write down in code?