#include #define MASK05_00 (0x3f) /*6 bits at a time*/ #define MASK11_06 (MASK05_00 << 6) #define MASK17_12 (MASK11_06 << 6) #define MASK23_18 (MASK17_12 << 6) int main (int argc, char **argv) { unsigned char in [24] = { 00, 16, 131, 16, 81, 135, 32, 146, 139, 48, 211, 143, 65, 20, 147, 81, 85, 151, 97, 150, 155, 113, 215, 159}; unsigned char out [32]; void expand6 (unsigned char *in, unsigned char* out); void hexdump (unsigned char *p, int n); expand6(in, out); hexdump(in, 24); hexdump(out, 32); return(0); } void expand6 (unsigned char *in, unsigned char* out) { unsigned int temp; int i; for (i=0; i<8; i++) /*8 24 bit sequences */ { temp = *in++ << 16; temp |= *in++ << 8; temp |= *in++; *out++ = (temp & MASK23_18)>>18; *out++ = (temp & MASK17_12)>>12; *out++ = (temp & MASK11_06)>>6; *out++ = (temp & MASK05_00); } } void hexdump(unsigned char *p, int n) { int i; for (i=0; i