Encoding data using C++

hi

Does anyone knows how to encode higher bit data into smaller bit data... for example. i have higher bit data as 1,0,1,1,0,1,..........32-bit data. How to encode this 32-bit data into for 8-bit data. I know this is possible.

Can we implement it using HASH algorithm or some other?

Please reply as soon as possible.....

How to encode this 32-bit data into for 8-bit data.

Assuming you mean four 8-bit data.

8_bit_val_1 = 32_bit_val >> 24;
8_bit_val_2 = (32_bit_val >> 16) & 0xFF;
8_bit_val_3 = (32_bit_val >> 8) & 0xFF;
8_bit_val_4 = 32_bit_val & 0xFF;

Rob