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


C++ des函数代码示例

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


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

示例1: reader

// static
void Serdes::DeserializeInfo(std::vector<int8_t> const & bytes, Info & result)
{
  MemReader reader(bytes.data(), bytes.size());
  NonOwningReaderSource source(reader);

  auto version = static_cast<int8_t>(Version::Unknown);
  ReadPrimitiveFromSource(source, version);
  if (version == static_cast<int8_t>(Version::V0))
  {
    try
    {
      // TODO: Use temporary object InfoV0 and implement method to convert it to Info,
      // TODO: when InfoV1 will be implemented.
      coding::DeserializerJson des(source);
      des(result);
    }
    catch (base::Json::Exception & ex)
    {
      LOG(LERROR, ("Cannot deserialize eye file. Exception:", ex.Msg(), "Version:", version,
                   "File content:", std::string(bytes.begin(), bytes.end())));
    }
    return;
  }

  MYTHROW(UnknownVersion, ("Unknown data version:", static_cast<int>(version)));
}
开发者ID:milchakov,项目名称:omim,代码行数:27,代码来源:eye_serdes.cpp

示例2: destests

static void
destests(void)
{
	des("", "");
	des("The quick brown fox jumps over the lazy dog",
	    "51551eab3ebab959553caaed64a3dd9c49f595a630c45cb7317332f8ade70308c4e97aeabbdc7f19");
	des("test des encryption",
	    "7ced9849bed3f7efc1686c89759bafa8");
}
开发者ID:RQZeng,项目名称:freetds,代码行数:9,代码来源:challenge.c

示例3: rfb_crypt

void rfb_crypt(CARD8 *dst_buf, CARD8 *src_buf, unsigned char *password)
{
  unsigned char key[8];

  memset(key, 0, 8);
  strncpy((char *)key, (char *)password, 8);
  deskey(key, EN0);
  des(src_buf, dst_buf);
  des(src_buf + 8, dst_buf + 8);
}
开发者ID:hanzhaogang,项目名称:chromium-1,代码行数:10,代码来源:rfblib.c

示例4: memset

/**
  * @brief  Build ethernet frame and send out.
  * @param  See below.
  * @retval Not sure.
  */
int enet_send
(
    /* Pointer to wireless network layer's environment structure. */
    wnet_envar_t *p_wnet, 

    /* Pointer to wireless network layer transfer information. */
    wnet_txinfo_t *txinfo, 

    /* Data address. */
    uint8_t *pdata, 

    /* Data length. */
    uint32_t length
)
{
    wnet_enet_header_st_ptr enet_header_ptr = NULL;

    
    /* Reserve room for ENET header. */
    pdata -= WNET_ENET_HEADER_ST_LEN;
    length += WNET_ENET_HEADER_ST_LEN;
    enet_header_ptr = (wnet_enet_header_st_ptr)pdata;

    /* Initialize enet frame header.  */
    memset(enet_header_ptr, 0, WNET_ENET_HEADER_ST_LEN);

    /* Set enet frame destination address and source address. */
    COPY_MAC_ADDR(enet_header_ptr->dest_address, BroadcastAddr);
    
    /* Mac address is bind to the CPU's unique ID */
    enet_header_ptr->src_address[0] = 0x00;
    enet_header_ptr->src_address[1] = 0x11;
    enet_header_ptr->src_address[2] = 0x22;
    enet_header_ptr->src_address[3] = des(2);
    enet_header_ptr->src_address[4] = des(1);
    enet_header_ptr->src_address[5] = des(0);


    switch (txinfo->protocol) 
    {
        case WNET_TRANS_PROT_DSMP:
        { 
            enet_header_ptr->ether_type = cv_ntohs(LLC_ETHERTYPE_DSMPv1);    break;
        }
    
        default:
        {
            OSAL_MODULE_DBGPRT(MODULE_NAME, OSAL_DEBUG_INFO, "Invalid protocol[0x%04x], dropped.\n", txinfo->protocol);
            return -1;
        }
    }
    
    return fp_send(p_wnet, txinfo, pdata, length);
}
开发者ID:gexueyuan,项目名称:muticus,代码行数:59,代码来源:app_wnet.c

示例5: des

void des(int y, int x)
{
    if(map[y][x]!=0)    return;
    map[y][x] = 1;
    //prtout(4,4);
    //printf("\n");
    des(y,x+1);
    des(y,x-1);
    des(y+1,x);
    des(y-1,x);
    return;
}
开发者ID:peter0749,项目名称:TOJ,代码行数:12,代码来源:q42.c

示例6: DREover

static void DREover(const unsigned char *ECMdata, unsigned char *DW)
{
    uchar key[8];
    if(ECMdata[2] >= (43+4) && ECMdata[40] == 0x3A && ECMdata[41] == 0x4B)
    {
        memcpy(key, &DESkeys[(ECMdata[42] & 0x0F) * 8], 8);

        doPC1(key);

        des(key, DES_ECS2_DECRYPT, DW); // even DW post-process
        des(key, DES_ECS2_DECRYPT, DW+8); // odd DW post-process
    };
};
开发者ID:r3dnax,项目名称:enigma2pc,代码行数:13,代码来源:reader-dre.c

示例7: vncEncryptBytes2

/*
 *   [email protected]
 *   Encrypt bytes[length] in memory using key.
 *   Key has to be 8 bytes, length a multiple of 8 bytes.
*/
void
vncEncryptBytes2(unsigned char *where, const int length, unsigned char *key) {
	int i, j;
	deskey(key, EN0);
	for (i = 0; i< 8; i++)
		where[i] ^= key[i];
	des(where, where);
	for (i = 8; i < length; i += 8) {
		for (j = 0; j < 8; j++)
			where[i + j] ^= where[i + j - 8];
		des(where + i, where + i);
	}
}
开发者ID:chiradeep,项目名称:CloudStack,代码行数:18,代码来源:vncauth.c

示例8: vncDecryptBytes

/*
 *   [email protected]
 *   Decrypt bytes[length] in memory using key.
 *   Key has to be 8 bytes, length a multiple of 8 bytes.
 */
void
vncDecryptBytes(unsigned char *where, const int length, const unsigned char *key) {
	int i, j;
	deskey((unsigned char*) key, DE1);
	for (i = length - 8; i > 0; i -= 8) {
		des(where + i, where + i);
		for (j = 0; j < 8; j++)
			where[i + j] ^= where[i + j - 8];
	}
	/* i = 0 */
	des (where, where);
	for (i = 0; i < 8; i++)
		where[i] ^= key[i];
}
开发者ID:FrantisekKlika,项目名称:UltraVncAsDll,代码行数:19,代码来源:vncauth.c

示例9: vncDecryptPasswdFromFile2

int
vncDecryptPasswdFromFile2(char *fname,
			  char *passwdFullControl, char *passwdViewOnly)
{
    FILE *fp;
    int i, ch;
    char passwd[16];

    if (strcmp(fname, "-") != 0) {
	if ((fp = fopen(fname,"r")) == NULL)
	    return 0;		/* Could not open the file */
    } else {
	fp = stdin;
    }

    for (i = 0; i < 16; i++) {
	ch = getc(fp);
	if (ch == EOF)
	    break;
	passwd[i] = ch;
    }

    if (fp != stdin)
	fclose(fp);

    if (i < 8)
	return 0;		/* Could not read eight bytes */

    deskey(s_fixedkey, DE1);

    /* Decoding first (full-control) password */
    if (passwdFullControl != NULL) {
	des(passwd, passwd);
	memcpy(passwdFullControl, passwd, 8);
	passwdFullControl[8] = '\0';
    }

    /* Decoding second (view-only) password if available */
    if (i == 16 && passwdViewOnly != NULL) {
	des(&passwd[8], &passwd[8]);
	memcpy(passwdViewOnly, &passwd[8], 8);
	passwdViewOnly[8] = '\0';
    }

    /* Destroying our copy of clear-text passwords */
    memset(passwd, 0, 16);

    return (i < 16) ? 1 : 2;
}
开发者ID:alerque,项目名称:fbvnc,代码行数:49,代码来源:vncauth.c

示例10: vncDecryptPasswdFromFile

char *
vncDecryptPasswdFromFile(char *fname)
{
    FILE *fp;
    int i, ch;
    unsigned char *passwd = (unsigned char *)malloc(9);

    if (strcmp(fname, "-") != 0) {
	if ((fp = fopen(fname,"r")) == NULL)
	    return NULL;
    } else {
	fp = stdin;
    }

    for (i = 0; i < 8; i++) {
	ch = getc(fp);
	if (ch == EOF)
	    break;
	passwd[i] = ch;
    }

    if (fp != stdin)
	fclose(fp);

    if (i != 8)                 /* Could not read eight bytes */
	return NULL;

    deskey(s_fixedkey, DE1);
    des(passwd, passwd);

    passwd[8] = 0;

    return (char *)passwd;
}
开发者ID:gvsurenderreddy,项目名称:AlmostVPNPro,代码行数:34,代码来源:vncauth.c

示例11: defined

void CLogOutputSink::writeLogMessage( String& strMsg )
{
    if ( strMsg.length() > 1 && strMsg[strMsg.length()-2] == '\r' )
        strMsg.erase(strMsg.length()-2,1);

    const char* szMsg = strMsg.c_str(); 

#if defined( OS_WINDOWS_DESKTOP )
		::OutputDebugStringA(szMsg);
#elif defined( OS_PLATFORM_MOTCE )
		::OutputDebugStringW(common::convertToStringW(strMsg).c_str());
#elif defined(OS_WP8)
		::OutputDebugStringA(szMsg);
#elif defined( OS_SYMBIAN )
        TPtrC8 des((const TUint8*)szMsg);
      	RDebug::RawPrint(des);
        return;
#endif

#if !defined( OS_PLATFORM_MOTCE )
    for( int n = 0; n < (int)strMsg.length(); n+= 100 )
        fwrite(szMsg+n, 1, min(100,strMsg.length()-n) , stdout );

    fflush(stdout);
#endif
}
开发者ID:CSanshulgandhi,项目名称:rhodes,代码行数:26,代码来源:RhoLogSink.cpp

示例12: switch

// original RMessage is supplied so that remote demux plugin can extract necessary details
// using DeMux utility
TInt CMMFIlbcDecoderIntfcDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage)
	{
	TMMFDevSoundCIMessageData data;
	TInt result = KErrGeneral;

	// decode message
	iUtility->GetSyncMessageDataL(aMessage, data);

	switch (data.iCommand)
		{
		case EMMFDevSoundCIIlbcDecoderIntfcGetComfortNoiseGeneration:
			{
			TPckgBuf<TBool> cng; 
			iUtility->ReadFromInputDesL(aMessage, &cng);

			result = DoGetComfortNoiseGenerationL(cng());

			TPckgBuf<TBool> des(cng());
			iUtility->WriteToOutputDesL(aMessage, des);

			break;
			}
		default:
			{
			User::Leave(KErrNotSupported);
			}
		}

	return result;
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:32,代码来源:ilbcdecoderconfigci.cpp

示例13: vec

//--------------------------------------------------------------
void testApp::update() {
	
	float t = (ofGetElapsedTimef()) * 0.9f;
	float div = 250.0;
	
	for (int i=0; i<NUM_BILLBOARDS; i++) {
		
		// noise 
		ofVec3f vec(ofSignedNoise(t, billboards.getVertex(i).y/div, billboards.getVertex(i).z/div),
								ofSignedNoise(billboards.getVertex(i).x/div, t, billboards.getVertex(i).z/div),
								ofSignedNoise(billboards.getVertex(i).x/div, billboards.getVertex(i).y/div, t));
		
		vec *= 10 * ofGetLastFrameTime();
		billboardVels[i] += vec;
		billboards.getVertices()[i] += billboardVels[i]; 
		billboardVels[i] *= 0.94f; 
    	billboards.setNormal(i,ofVec3f(12 + billboardSizeTarget[i] * ofNoise(t+i),0,0));
	}
	
	
	// move the camera around
	float mx = (float)mouseX/(float)ofGetWidth();
	float my = (float)mouseY/(float)ofGetHeight();
	ofVec3f des(mx * 360.0, my * 360.0, 0);
	cameraRotation += (des-cameraRotation) * 0.03;
	zoom += (zoomTarget - zoom) * 0.03;
	
}
开发者ID:andreasmuller,项目名称:RaspberryPiWorkshop,代码行数:29,代码来源:testApp.cpp

示例14: switch

// original RMessage is supplied so that remote demux plugin can extract necessary details
// using DeMux utility
TInt CMMFG711EncoderIntfcDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage)
	{
	TMMFDevSoundCIMessageData data;
	TInt result = KErrNone;

	// decode message
	iUtility->GetSyncMessageDataL(aMessage, data);

	switch (data.iCommand)
		{
		case EMMFDevSoundCIG711EncoderIntfcGetVadMode:
			{
			TPckgBuf<TBool> vadModeOn; 
			iUtility->ReadFromInputDesL(aMessage, &vadModeOn);

			result = DoGetVadMode(vadModeOn());

			TPckgBuf<TBool> des(vadModeOn());
			iUtility->WriteToOutputDesL(aMessage, des);

			break;
			}
		default:
			{
			User::Leave(KErrNotSupported);
			}
		}

	return result;
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:32,代码来源:g711encoderconfigci.cpp

示例15: RunTest

LOCAL_C void RunTest(TInt aSize)
	{
	const TInt KTestRunUs = KTestRunSeconds * 1000000;

	RThread t;
	TInt r=t.Create(KNullDesC,TestThread,0x1000,NULL,(TAny*)aSize);
	test(r==KErrNone);
	t.SetPriority(EPriorityLess);
	TRequestStatus s;
	t.Logon(s);
	t.Resume();
	ServerSem.Wait();
	test(Server.Handle() != KNullHandle);

	RMySession sess;
	TRequestStatus stat;
	test(sess.Connect(Server,stat) == KErrNone);
	User::WaitForRequest(stat);	// connected

	Count=0;
	TPtr8 des((TUint8*)Dest, 0, aSize);
	sess.Test(des);
	User::After(KTestRunUs);
	t.Kill(0);
	User::WaitForRequest(s);
	sess.Close();
	Server.Close();
	CLOSE_AND_WAIT(t);

	TInt us=10*KTestRunUs/Count;
	test.Printf(_L("%5d byte writes: %8d/%ds %4d.%01dus\n"),aSize,Count,KTestRunSeconds,us/10,us%10);
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:32,代码来源:t_ipcbm.cpp


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