当前位置: 首页>>代码示例>>C++>>正文


C++ PrintHex函数代码示例

本文整理汇总了C++中PrintHex函数的典型用法代码示例。如果您正苦于以下问题:C++ PrintHex函数的具体用法?C++ PrintHex怎么用?C++ PrintHex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PrintHex函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ProcessVector

/*
 * Process a test vector.
 */
static void ProcessVector(RC2TestVector *vector)
{
	ILRC2Context rc2;
	unsigned char ciphertext[8];
	unsigned char reverse[8];

	/* Encrypt and decrypt the plaintext */
	ILRC2Init(&rc2, vector->key, vector->keyBits);
	ILRC2Encrypt(&rc2, vector->plaintext, ciphertext);
	ILRC2Decrypt(&rc2, ciphertext, reverse);
	ILRC2Finalize(&rc2);

	/* Report the results */
	printf("Key                 = ");
	PrintHex(vector->key, vector->keyBits);
	printf("Plaintext           = ");
	PrintHex(vector->plaintext, 64);
	printf("Expected Ciphertext = ");
	PrintHex(vector->expected, 64);
	printf("Actual Ciphertext   = ");
	PrintHex(ciphertext, 64);
	printf("Reverse Plaintext   = ");
	PrintHex(reverse, 64);
	if(ILMemCmp(vector->expected, ciphertext, 8) != 0)
	{
		printf("*** Test failed: ciphertexts do not match ***\n");
	}
	if(ILMemCmp(vector->plaintext, reverse, 8) != 0)
	{
		printf("*** Test failed: plaintexts do not match ***\n");
	}
	printf("\n");
}
开发者ID:bencz,项目名称:DotGnu,代码行数:36,代码来源:rc2.c

示例2: TargetRead

// Receive test DONE message from target.
void
CeCosTestSerialFilter::ReceiveDone(CeCosSerial &pSer, 
                                   unsigned char* data_in, int size)
{
    static const char msg_done[] = "DONE";
    unsigned char data_reply[4];
    int first = 1;

    TargetRead(pSer, data_reply, 4);
    while (0 != strncmp((char*) data_reply, msg_done, 4)) {
        if (first) {
            if (data_in && size) {
                Trace("Data received from target:\n");
                PrintHex(data_in, size);
                Trace("<end>\n");
            }
            Trace("Receiving junk instead of DONE:\n");
            first = 0;
        }
        PrintHex(data_reply, 4);

        data_reply[0] = data_reply[1];
        data_reply[1] = data_reply[2];
        data_reply[2] = data_reply[3];

        // The TargetRead call will handle recovery in case of timeout...
        TargetRead(pSer, &data_reply[3], 1);
    }
}
开发者ID:Robertysc,项目名称:ecos,代码行数:30,代码来源:eCosTestSerialFilter.cpp

示例3: LOGTRACE

bool TvDevice::smartcard_transmit(const BYTE *pInput, int inputLen,BYTE *pOutput,int *outputLen)
{
	bool bRet = false;
	int  iRet = 0;

#ifdef TVDEVICE_DEBUG_PRINT
	LOGTRACE(LOGINFO,"===IN=== pInput=%s,len=%d.\n",PrintHex(pInput,inputLen),inputLen);
#endif 

#if defined(WIN32)

	DWORD dwRetBytes = 0;
	DWORD dwOutBufSize  = *outputLen;
	BOOL  b = DeviceIoControl (
		h_,
		IOCTL_NOVELUSB_GET_SMARTCART_DATA,
		(LPVOID)pInput,
		inputLen,
		pOutput,
		dwOutBufSize,
		&dwRetBytes,
		NULL);
	if(b)
	{
		*outputLen = dwRetBytes;
		bRet = true;
	}

#else
	{
		AutoLockT lock(mutex_);
		CA_SCARD_CMD ca_cmd;
		ca_cmd.nCommandLen = inputLen;
		memcpy(ca_cmd.Command,pInput,inputLen);

		iRet = ioctl(h_, RT10UP_CA_SC_TRANSMIT, &ca_cmd); 
	
		if(0 <= iRet)
		{
			bRet = true;
			*outputLen = ca_cmd.nReplyLen;
			memcpy(pOutput,ca_cmd.Reply,ca_cmd.nReplyLen);
		}

	}
#endif 

#ifdef TVDEVICE_DEBUG_PRINT
	LOGTRACE(LOGINFO,"===OUT===pOutput=%s,len=%d,bRet=%d,iRet=%d.\n",PrintHex(pOutput,*outputLen),*outputLen,bRet,iRet);
#endif 
	
	return bRet;
}
开发者ID:cg8530,项目名称:WorkSplace,代码行数:53,代码来源:tunerdevice.cpp

示例4: getAAAKey

int TMsg::setAuthInfoKey() {
#ifndef MOD_DISABLE_AUTH
    //  key = HMAC-SHA1 (AAA-key, {Key Generation Nonce || client identifier})

    char *KeyGenNonce_ClientID;
    char * AAAkey;
    uint32_t AAAkeyLen;

    if (!KeyGenNonce)
        KeyGenNonceLen = 16;

    /// @todo set proper size of Client ID (DUID?) (here and in hmac_sha())
    KeyGenNonce_ClientID = new char[KeyGenNonceLen+128];

    AAAkey = getAAAKey(AAASPI, &AAAkeyLen);
    std::string fname = getAAAKeyFilename(AAASPI);

    // error, no file?
    if (!AAAkey) {
        Log(Error) << "Auth: Unable to load key file for SPI " << std::hex << AAASPI <<": " << fname 
                   << " not found." << std::dec << LogEnd;
        AuthInfoKey = NULL;
        delete [] KeyGenNonce_ClientID;
        return -1;
    }
    Log(Debug) << "Auth: AAA-key loaded from file " << fname << "." << LogEnd;

    PrintHex("Auth: AAA-key: ", AAAkey, AAAkeyLen);

    memset(KeyGenNonce_ClientID, 0, KeyGenNonceLen+128);
    if (KeyGenNonce)
        memcpy(KeyGenNonce_ClientID, KeyGenNonce, KeyGenNonceLen);

    /// @todo fill also with ClientID (DUID?)

    PrintHex("Auth: Infokey: using KeyGenNonce+CliendID: ", KeyGenNonce_ClientID, KeyGenNonceLen+128);

    Log(Debug) << "Auth: AAAKeyLen: " << AAAkeyLen << ", KeyGenNonceLen: " << KeyGenNonceLen << LogEnd;
    AuthInfoKey = new char[AUTHKEYLEN];
    hmac_sha(KeyGenNonce_ClientID, KeyGenNonceLen+128, AAAkey, AAAkeyLen, (char *)AuthInfoKey, 1);

    PrintHex("Auth: AuthInfoKey (calculated): ", AuthInfoKey, AUTHKEYLEN);

    delete [] KeyGenNonce_ClientID;
#endif

    return 0;
}
开发者ID:DamianManelski,项目名称:dibbler-v-1.2,代码行数:48,代码来源:Msg.cpp

示例5: Print

void Print (const uint64 &number)
{
	if (number.HighPart == 0)
		Print (number.LowPart);
	else
		PrintHex (number);
}
开发者ID:idukas,项目名称:VeraCrypt,代码行数:7,代码来源:BootConsoleIo.cpp

示例6: PrintResetSource

/* Prints reset code and the interrupt type */
static void PrintResetSource(unsigned int Source)
{  
  PrintString("ResetSource 0x");
  PrintHex(Source);

#if 0
  PrintString(" - ");
  switch (Source)
  {
  case 0x0000: PrintString("No interrupt pending"); break;
  case 0x0002: PrintString("Brownout (BOR) (highest priority)"); break;
  case 0x0004: PrintString("RST/NMI (BOR)"); break;
  case 0x0006: PrintString("PMMSWBOR (BOR)"); break;
  case 0x0008: PrintString("Wakeup from LPMx.5 (BOR)"); break;
  case 0x000A: PrintString("Security violation (BOR)"); break;
  case 0x000C: PrintString("SVSL (POR)"); break;
  case 0x000E: PrintString("SVSH (POR)"); break;
  case 0x0010: PrintString("SVML_OVP (POR)"); break;
  case 0x0012: PrintString("SVMH_OVP (POR)"); break;
  case 0x0014: PrintString("PMMSWPOR (POR)"); break;
  case 0x0016: PrintString("WDT time out (PUC)"); break;
  case 0x0018: PrintString("WDT password violation (PUC)"); break;
  case 0x001A: PrintString("Flash password violation (PUC)"); break;
  case 0x001C: PrintString("PLL unlock (PUC)"); break;
  case 0x001E: PrintString("PERF peripheral/configuration area fetch (PUC)"); break;
  case 0x0020: PrintString("PMM password violation (PUC)"); break;
  default:     PrintString("Unknown"); break;
  }
#endif
  PrintString(CR);
}
开发者ID:Tangkw,项目名称:MetaWatch-Gen2,代码行数:32,代码来源:IdleTask.c

示例7: PrintResEvent

static bool PrintResEvent(void)
{
    SmonViceId Vice; 
    unsigned long Time;
    unsigned long Volid;
    long HighWaterMark;
    long AllocNumber;
    long DeallocNumber;
    unsigned long ResOpSize;
    ResOpEntry *ResOp;

    int sum = ReadResEvent(&Vice,&Time,&Volid,&HighWaterMark,&AllocNumber,
		       &DeallocNumber,&ResOpSize,&ResOp);

    if (sum != 0) LogMsg(0,LogLevel,LogFile,"**** BAD RESOLUTION RECORD ****");

    printf("%-12s: ","SRVRES");
    PrintViceId(&Vice);
    PrintDecimal(Time);
    PrintHex(Volid);
    PrintDecimal(HighWaterMark);
    PrintDecimal(AllocNumber);
    PrintDecimal(DeallocNumber);
    printf("\n");
    PrintResOpArray(ResOpSize,ResOp);
    printf("\n");
    printf("=================================================\n");

    delete [] ResOp;

    if (sum) return mtrue;
    else return mfalse;
}
开发者ID:chutzimir,项目名称:coda,代码行数:33,代码来源:parselog.c

示例8: _L

// -----------------------------------------------------------------------------
// COMASuplWapListener::CheckBinaryContentType
// 
// -----------------------------------------------------------------------------
//
TBool COMASuplWapListener::CheckBinaryContentType(CPushMessage* aPushMsg)
{
	TPtrC8 field;
	TBool isHeaderPresent = aPushMsg->GetBinaryHeaderField(EHttpContentType, field);

#ifdef _DEBUG
	//Log the received message
    iTrace->Trace( _L( "Received Binary Content Type is:" ), KTraceFileName, __LINE__ );
    PrintHex(field, __LINE__);
#endif

	if( isHeaderPresent )
	{
		    iTrace->Trace( _L( "Binary Content type present..." ), KTraceFileName, __LINE__ );
			TUint8 code = field[0];
			
			//if(code>0x7F && ((code&0x7F) == KSupportedHEXContentType) )                 //      Content-type-value =  Short-integer
            if (field[1] == 0x03 && field[2] == 0x12)
			{
				return ETrue;
			}	
	}
	else
	{
		iTrace->Trace( _L( "No Binary Content type present..." ), KTraceFileName, __LINE__ );
	}
	return EFalse;
}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:33,代码来源:epos_comasuplwaplistener.cpp

示例9: Pins

boolean Adafruit_NFCShield_I2C::writeGPIO(uint8_t pinstate) {
  uint8_t errorbit;

  // Make sure pinstate does not try to toggle P32 or P34
  pinstate |= (1 << PN532_GPIO_P32) | (1 << PN532_GPIO_P34);
  
  // Fill command buffer
  pn532_packetbuffer[0] = PN532_COMMAND_WRITEGPIO;
  pn532_packetbuffer[1] = PN532_GPIO_VALIDATIONBIT | pinstate;  // P3 Pins
  pn532_packetbuffer[2] = 0x00;    // P7 GPIO Pins (not used ... taken by I2C)

  #ifdef PN532DEBUG
    Serial.print("Writing P3 GPIO: "); Serial.println(pn532_packetbuffer[1], HEX);
  #endif

  // Send the WRITEGPIO command (0x0E)  
  if (! sendCommandCheckAck(pn532_packetbuffer, 3))
    return 0x0;
  
  // Read response packet (00 00 FF PLEN PLENCHECKSUM D5 CMD+1(0x0F) DATACHECKSUM)
  wirereaddata(pn532_packetbuffer, 8);

  #ifdef PN532DEBUG
    Serial.print("Received: ");
    PrintHex(pn532_packetbuffer, 8);
    Serial.println("");
  #endif  
  
  return  (pn532_packetbuffer[6] == 0x0F);
}
开发者ID:logic-fault,项目名称:ethernet-QEL,代码行数:30,代码来源:Adafruit_NFCShield_I2C.cpp

示例10: PrintVCB

static bool PrintVCB() {
    VmonVenusId Venus;
    long VenusInit;
    long Time;
    VolumeId Volume;
    VCBStatistics Stats;
    
    int sum = ReadVCB(&Venus, &VenusInit, &Time, &Volume, &Stats);

    if (sum != 0) LogMsg(0,LogLevel,LogFile,"**** BAD VCB RECORD ****");
    
    printf("%-12s: ","VCB");
    PrintVenusId(&Venus);
    PrintDecimal(VenusInit);
    PrintDecimal(Time);
    printf("\n");
    PrintHex(Volume);
    printf("\n");
    PrintVCBStats(&Stats);
    printf("\n");
    printf("=================================================\n");

    if (sum) return mtrue;
    else return mfalse;
}
开发者ID:chutzimir,项目名称:coda,代码行数:25,代码来源:parselog.c

示例11: UsbChipReadEndpointBuffer

/********************************************************************
函数功能:读取端点缓冲区函数。
入口参数:Endp:端点号;Len:需要读取的长度;Buf:保存数据的缓冲区。
返    回:实际读到的数据长度。
备    注:无。
********************************************************************/
uint8 UsbChipReadEndpointBuffer(uint8 Endp, uint8 Len, uint8 *Buf)
{
 uint8 i,j;
 UENUM=Endp; //选择端点
 j=UEBCLX; //获取数据长度
 if(j>Len) //如果要读的字节数比实际接收到的数据长
 {
  j=Len;  //则只读指定的长度数据
 }
#ifdef DEBUG1 //如果定义了DEBUG1,则需要显示调试信息
 Prints("读端点");
 PrintLongInt(Endp);
 Prints("缓冲区");
 PrintLongInt(j);      //实际读取的字节数
 Prints("字节。\r\n");
#endif
 for(i=0;i<j;i++)
 {
  *(Buf+i)=UEDATX;  //从FIFO中读一字节数据
#ifdef DEBUG1
  PrintHex(*(Buf+i)); //如果需要显示调试信息,则显示读到的数据
  if(((i+1)%16)==0)Prints("\r\n"); //每16字节换行一次
#endif
 }
#ifdef DEBUG1
 if((j%16)!=0)Prints("\r\n"); //换行。
#endif
 return j; //返回实际读取的字节数。
}
开发者ID:zzy-driver,项目名称:usb,代码行数:35,代码来源:AT90USB.c

示例12: UsbChipWriteEndpointBuffer

/********************************************************************
函数功能:将数据写入端点缓冲区函数。
入口参数:Endp:端点号;Len:需要发送的长度;Buf:保存数据的缓冲区。
返    回:Len的值。
备    注:无。
********************************************************************/
uint8 UsbChipWriteEndpointBuffer(uint8 Endp,uint8 Len,uint8 * Buf)
{
 uint8 i;
 
#ifdef DEBUG1 //如果定义了DEBUG1,则需要显示调试信息
 Prints("写端点");
 PrintLongInt(Endp);
 Prints("缓冲区");
 PrintLongInt(Len);    //写入的字节数
 Prints("字节。\r\n");
#endif
 for(i=0;i<Len;i++)
 {
  AT91C_UDP_FDR[Endp]=*(Buf+i); //将数据写到FIFO中
#ifdef DEBUG1
  PrintHex(*(Buf+i));  //如果需要显示调试信息,则显示发送的数据
  if(((i+1)%16)==0)Prints("\r\n"); //每16字节换行一次
#endif
  }
#ifdef DEBUG1
 if((Len%16)!=0)Prints("\r\n"); //换行
#endif
 UsbChipValidateBuffer(Endp); //使端点数据有效
 return Len; //返回Len
}
开发者ID:zzy-driver,项目名称:usb,代码行数:31,代码来源:AT91SAMxUSB.c

示例13: PrintVal

void PrintVal (const char *message, const uint64 &value, bool newLine, bool hex)
{
	Print (message);
	Print (": ");
	PrintHex (value);
	if (newLine)
		PrintEndl();
}
开发者ID:ggielly,项目名称:GostCrypt_Windows_1.0,代码行数:8,代码来源:BootDebug.cpp

示例14: main

int main() {
  HMODULE hNsi = LoadLibraryW(L"Nsi.dll");
  NsiGetParameterProc _NsiGetParameter = (NsiGetParameterProc)GetProcAddress(hNsi, "NsiGetParameter");

  // Declare and initialize variables
  PIP_INTERFACE_INFO pInfo = NULL;
  ULONG ulOutBufLen = 0;

  DWORD dwRetVal = 0;
  int iReturn = 1;

  int i;

  // Make an initial call to GetInterfaceInfo to get
  // the necessary size in the ulOutBufLen variable
  dwRetVal = GetInterfaceInfo(NULL, &ulOutBufLen);
  if (dwRetVal == ERROR_INSUFFICIENT_BUFFER) {
    pInfo = (IP_INTERFACE_INFO *)MALLOC(ulOutBufLen);
    if (pInfo == NULL) {
      printf
        ("Unable to allocate memory needed to call GetInterfaceInfo\n");
      return 1;
    }
  }
  // Make a second call to GetInterfaceInfo to get
  // the actual data we need
  dwRetVal = GetInterfaceInfo(pInfo, &ulOutBufLen);
  if (dwRetVal == NO_ERROR) {
    printf("Number of Adapters: %ld\n\n", pInfo->NumAdapters);
    for (i = 0; i < pInfo->NumAdapters; i++) {
      printf("Adapter Index[%d]: %ld\n", i,
        pInfo->Adapter[i].Index);

      NET_LUID Luid;
      NETIO_STATUS st = ConvertInterfaceIndexToLuid(pInfo->Adapter[i].Index, &Luid);
      if (st == NO_ERROR) {
        BYTE OutputBuffer[0xB8] = { /* zero padding */ };
        DWORD nsi_st = _NsiGetParameter(1, NPI_MS_IPV4_MODULEID, 7, &Luid, sizeof(Luid), 0, OutputBuffer, sizeof(OutputBuffer), 0);
        if (nsi_st == NO_ERROR) {
          PrintHex(OutputBuffer, sizeof(OutputBuffer));
        }
      }
    }
    iReturn = 0;
  }
  else if (dwRetVal == ERROR_NO_DATA) {
    printf
      ("There are no network adapters with IPv4 enabled on the local system\n");
    iReturn = 0;
  }
  else {
    printf("GetInterfaceInfo failed with error: %d\n", dwRetVal);
    iReturn = 1;
  }

  FREE(pInfo);
  return (iReturn);
}
开发者ID:AlexxNica,项目名称:exploit-database,代码行数:58,代码来源:42338.cpp

示例15: list_print

void list_print(virus *virus_list){
  while(virus_list != 0){
    printf("Virus name: %s\n",virus_list->name);
    printf("Virus size: %d\n",virus_list->length);
    printf("signature:\n");
    PrintHex(virus_list->signature, virus_list->length);
    virus_list = virus_list->next;
  }
}
开发者ID:liranr23,项目名称:C,代码行数:9,代码来源:task1c.c


注:本文中的PrintHex函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。