1 int CEnCryptionAndDeCryptionDlg::Byte2Hex(const unsigned char* input,unsigned long inLen, 2 unsigned char* outPut,unsigned long* outLen) 3 { 4 static const char* num="0123456789ABCDEF"; 5 unsigned long i=0; 6 unsigned char *p=outPut; 7 8 if (*outLen<inLen*2) 9 { 10 *outLen=inLen*2; 11 return -1; 12 } 13 14 for (int i=0;i<inLen;i++) 15 { 16 *p++=num[input[i]>>4]; 17 *p++=num[input[i]&0x0f]; 18 } 19 *outLen=p-outPut; 20 return 0; 21 22 }
CString outPut=outPut;