treat unsigned char* as input buffer.