當前位置: 首頁>>代碼示例>>C++>>正文


C++ GETBYTE函數代碼示例

本文整理匯總了C++中GETBYTE函數的典型用法代碼示例。如果您正苦於以下問題:C++ GETBYTE函數的具體用法?C++ GETBYTE怎麽用?C++ GETBYTE使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GETBYTE函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: v2_attr_rply

static int v2_attr_rply(int flags) {
	int auth_cnt, i;
	unsigned short errcode;

	if (flags & F_SUM) {
	    GETSHORT(errcode);
	    if (errcode != OK) {
		strcat(msgbuf, slpv2_error(errcode));
		msglength = 0;	/* skip rest of message */
		return (0);
	    } else {
		GETFIELD;			/* attr list */

#ifdef VERIFYSLP
		GETBYTE(auth_cnt);
		for (i = 0; i < auth_cnt; i++)
		    if (skip_v2authblock() < 0)
			return (0);
#endif
	    }
	} else if (flags & F_DTAIL) {
	    V2_DOERRCODE;
	    DOFIELD("Attribute list", FIELD_DEFAULT);
	    /* auth */
	    GETBYTE(auth_cnt);
	    for (i = 0; i < auth_cnt; i++)
		V2_DOAUTH(i);
	}

	return (1);
}
開發者ID:jasonbking,項目名稱:illumos-gate,代碼行數:31,代碼來源:snoop_slp.c

示例2: v2_srv_reg

static int v2_srv_reg(int flags) {
	int i, auth_cnt;

	if (flags & F_SUM) {
	    SKIPBYTE;			/* reserved */
	    SKIPSHORT;			/* lifetime */
	    GETFIELD;			/* URL */
#ifdef VERIFYSLP
	    GETBYTE(auth_cnt);
	    for (i = 0; i < auth_cnt; i++)
		if (skip_v2authblock() < 0)
		    return (0);
	    SKIPFIELD(FIELD_DEFAULT);	/* type */
	    SKIPFIELD(FIELD_DEFAULT);	/* scopes */
	    SKIPFIELD(FIELD_DEFAULT);	/* attrs */
	    GETBYTE(auth_cnt);
	    for (i = 0; i < auth_cnt; i++)
		if (skip_v2authblock() < 0)
		    return (0);
#endif
	} if (flags & F_DTAIL) {
	    V2_DOURL(-1);
	    DOFIELD("Service type", FIELD_DEFAULT);
	    DOFIELD("Scopes", FIELD_DEFAULT);
	    DOFIELD("Attribute list", FIELD_DEFAULT);
	    /* auth */
	    GETBYTE(auth_cnt);
	    for (i = 0; i < auth_cnt; i++)
		V2_DOAUTH(i);
	}

	return (1);
}
開發者ID:jasonbking,項目名稱:illumos-gate,代碼行數:33,代碼來源:snoop_slp.c

示例3: v2_daadvert

static int v2_daadvert(int flags) {
	int auth_cnt, i;
	unsigned short errcode;
	unsigned int timestamp;

	if (flags & F_SUM) {
	    SKIPSHORT;			/* error code */
	    SKIPSHORT; SKIPSHORT;	/* timestamp */
	    GETFIELD;			/* URL */

#ifdef VERIFYSLP
	    SKIPFIELD(FIELD_DEFAULT);	/* scopes */
	    SKIPFIELD(FIELD_DEFAULT);	/* attrs */
	    SKIPFIELD(FIELD_DEFAULT);	/* SPIs */

	    GETBYTE(auth_cnt);
	    for (i = 0; i < auth_cnt; i++)
		if (skip_v2authblock() < 0)
		    return (0);
#endif
	} else if (flags & F_DTAIL) {
	    V2_DOERRCODE;
	    V2_DOTIMESTAMP;
	    DOFIELD("URL", FIELD_DEFAULT);
	    DOFIELD("Scope list", FIELD_DEFAULT);
	    DOFIELD("Attribute list", FIELD_DEFAULT);
	    DOFIELD("Configured SPIs", FIELD_DEFAULT);
	    /* auth */
	    GETBYTE(auth_cnt);
	    for (i = 0; i < auth_cnt; i++)
		V2_DOAUTH(i);
	}

	return (1);
}
開發者ID:jasonbking,項目名稱:illumos-gate,代碼行數:35,代碼來源:snoop_slp.c

示例4: v2_saadvert

static int v2_saadvert(int flags) {
	int auth_cnt, i;

	if (flags & F_SUM) {
	    GETFIELD;			/* URL */

#ifdef VERIFYSLP
	    SKIPFIELD(FIELD_DEFAULT);	/* scopes */
	    SKIPFIELD(FIELD_DEFAULT);	/* attrs */

	    GETBYTE(auth_cnt);
	    for (i = 0; i < auth_cnt; i++)
		if (skip_v2authblock() < 0)
		    return (0);
#endif
	} else if (flags & F_DTAIL) {
	    DOFIELD("URL", FIELD_DEFAULT);
	    DOFIELD("Scopes",  FIELD_DEFAULT);
	    DOFIELD("Attribute list", FIELD_DEFAULT);
	    /* auth */
	    GETBYTE(auth_cnt);
	    for (i = 0; i < auth_cnt; i++)
		V2_DOAUTH(i);
	}

	return (1);
}
開發者ID:jasonbking,項目名稱:illumos-gate,代碼行數:27,代碼來源:snoop_slp.c

示例5: GetUserKey

void Twofish::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
{
	unsigned int len = (keylen <= 16 ? 2 : (keylen <= 24 ? 3 : 4));
    word32 key[8];
	GetUserKey(LittleEndianOrder, key, len*2, userKey, keylen);

	unsigned int i;
	for (i=0; i<40; i+=2) {
		word32 a = h(i, key, len);
		word32 b = rotlFixed(h(i+1, key+1, len), 8);
		k_[i] = a+b;
		k_[i+1] = rotlFixed(a+2*b, 9);
	}

	word32 svec[8];
	for (i=0; i<len; i++)
		svec[2*(len-i-1)] = ReedSolomon(key[2*i+1], key[2*i]);

	for (i=0; i<256; i++) {
		word32 t = h0(i, svec, len);
		s_[0][i] = mds_[0][GETBYTE(t, 0)];
		s_[1][i] = mds_[1][GETBYTE(t, 1)];
		s_[2][i] = mds_[2][GETBYTE(t, 2)];
		s_[3][i] = mds_[3][GETBYTE(t, 3)];
	}
}
開發者ID:0x00xw,項目名稱:mysql-2,代碼行數:26,代碼來源:twofish.cpp

示例6: pgp_s2k_read

int
pgp_s2k_read(PullFilter *src, PGP_S2K *s2k)
{
	int			res = 0;

	GETBYTE(src, s2k->mode);
	GETBYTE(src, s2k->digest_algo);
	switch (s2k->mode)
	{
		case 0:
			break;
		case 1:
			res = pullf_read_fixed(src, 8, s2k->salt);
			break;
		case 3:
			res = pullf_read_fixed(src, 8, s2k->salt);
			if (res < 0)
				break;
			GETBYTE(src, s2k->iter);
			break;
		default:
			res = PXE_PGP_BAD_S2K_MODE;
	}
	return res;
}
開發者ID:0x0FFF,項目名稱:postgres,代碼行數:25,代碼來源:pgp-s2k.c

示例7: GETBYTE

void DataOutputStream::writeUInt16(UINT16 data)
{
  UINT8 buf[2];

  buf[0] = GETBYTE(data, 1);
  buf[1] = GETBYTE(data, 0);

  writeFully((char *)buf, sizeof(buf));
}
開發者ID:newmind,項目名稱:tvnc_rds,代碼行數:9,代碼來源:DataOutputStream.cpp

示例8: crypt_block

// this version is only used to make pbox and sbox
void Blowfish::crypt_block(const word32 in[2], word32 out[2]) const
{
	word32 left = in[0];
	word32 right = in[1];

	const word32 *const s=sbox;
	const word32 *p=pbox;

	left ^= p[0];

	for (unsigned i=0; i<ROUNDS/2; i++)
	{
		right ^= (((s[GETBYTE(left,3)] + s[256+GETBYTE(left,2)])
			  ^ s[2*256+GETBYTE(left,1)]) + s[3*256+GETBYTE(left,0)])
			  ^ p[2*i+1];

		left ^= (((s[GETBYTE(right,3)] + s[256+GETBYTE(right,2)])
			 ^ s[2*256+GETBYTE(right,1)]) + s[3*256+GETBYTE(right,0)])
			 ^ p[2*i+2];
	}

	right ^= p[ROUNDS+1];

	out[0] = right;
	out[1] = left;
}
開發者ID:killbug2004,項目名稱:WSProf,代碼行數:27,代碼來源:blowfish.cpp

示例9: ProcessAndXorBlock

void Blowfish::ProcessAndXorBlock(const byte* in, const byte* xOr, byte* out)
    const
{
    word32 left, right;
	const word32  *const s = sbox_;
    const word32* p = pbox_;
    
    gpBlock::Get(in)(left)(right);
	left ^= p[0];

    // roll back up and use s and p index instead of just p
    for (unsigned i = 0; i < ROUNDS / 2; i++) {
        right ^= (((s[GETBYTE(left,3)] + s[256+GETBYTE(left,2)])
            ^ s[2*256+GETBYTE(left,1)]) + s[3*256+GETBYTE(left,0)])
            ^ p[2*i+1];

        left ^= (((s[GETBYTE(right,3)] + s[256+GETBYTE(right,2)])
            ^ s[2*256+GETBYTE(right,1)]) + s[3*256+GETBYTE(right,0)])
            ^ p[2*i+2];
    }

	right ^= p[ROUNDS + 1];

    gpBlock::Put(xOr, out)(right)(left);
}
開發者ID:0x00xw,項目名稱:mysql-2,代碼行數:25,代碼來源:blowfish.cpp

示例10: BlowfishEncryptLE

void BlowfishEncryptLE (unsigned char *inBlock, unsigned char *outBlock, BF_KEY *key, int encrypt)
{
	word32 left = LE32 (((word32 *) inBlock)[0]);
	word32 right = LE32 (((word32 *) inBlock)[1]);

	const word32 *const s = key->sbox;
	const word32 * p = encrypt ? key->pbox : key->pbox_dec;

	unsigned i;

	left ^= p[0];

	for (i=0; i<ROUNDS/2; i++)
	{
		right ^= (((s[GETBYTE(left,3)] + s[256+GETBYTE(left,2)])
			  ^ s[2*256+GETBYTE(left,1)]) + s[3*256+GETBYTE(left,0)])
			  ^ p[2*i+1];

		left ^= (((s[GETBYTE(right,3)] + s[256+GETBYTE(right,2)])
			 ^ s[2*256+GETBYTE(right,1)]) + s[3*256+GETBYTE(right,0)])
			 ^ p[2*i+2];
	}

	right ^= p[ROUNDS+1];

	((word32 *) outBlock)[0] = LE32 (right);
	((word32 *) outBlock)[1] = LE32 (left);
}
開發者ID:4nt1m0n,項目名稱:truecrypt,代碼行數:28,代碼來源:Blowfish.c

示例11: crypt_block

// this version is only used to make pbox and sbox
static void crypt_block(BF_KEY *key, const word32 in[2], word32 out[2])
{
	word32 left = in[0];
	word32 right = in[1];

	const word32 *const s=key->sbox;
	const word32 *p=key->pbox;

	unsigned i;

	left ^= p[0];

	for (i=0; i<ROUNDS/2; i++)
	{
		right ^= (((s[GETBYTE(left,3)] + s[256+GETBYTE(left,2)])
			  ^ s[2*256+GETBYTE(left,1)]) + s[3*256+GETBYTE(left,0)])
			  ^ p[2*i+1];

		left ^= (((s[GETBYTE(right,3)] + s[256+GETBYTE(right,2)])
			 ^ s[2*256+GETBYTE(right,1)]) + s[3*256+GETBYTE(right,0)])
			 ^ p[2*i+2];
	}

	right ^= p[ROUNDS+1];

	out[0] = right;
	out[1] = left;
}
開發者ID:4nt1m0n,項目名稱:truecrypt,代碼行數:29,代碼來源:Blowfish.c

示例12: GetBlockBigEndian

void Blowfish::ProcessBlock(const byte *in, byte *out) const
{
	word32 left, right;
	GetBlockBigEndian(in, left, right);

	const word32 *const s=sbox;
	const word32 *p=pbox;

	left ^= p[0];

	for (unsigned i=0; i<ROUNDS/2; i++)
	{
		right ^= (((s[GETBYTE(left,3)] + s[256+GETBYTE(left,2)])
			  ^ s[2*256+GETBYTE(left,1)]) + s[3*256+GETBYTE(left,0)])
			  ^ p[2*i+1];

		left ^= (((s[GETBYTE(right,3)] + s[256+GETBYTE(right,2)])
			 ^ s[2*256+GETBYTE(right,1)]) + s[3*256+GETBYTE(right,0)])
			 ^ p[2*i+2];
	}

	right ^= p[ROUNDS+1];

	PutBlockBigEndian(out, right, left);
}
開發者ID:killbug2004,項目名稱:WSProf,代碼行數:25,代碼來源:blowfish.cpp

示例13: return

byte LC_RNG::GenerateByte()
{
	word32 hi = seed/q;
	word32 lo = seed%q;

	long test = a*lo - r*hi;

	if (test > 0)
		seed = test;
	else
		seed = test+ m;

	return (GETBYTE(seed, 0) ^ GETBYTE(seed, 1) ^ GETBYTE(seed, 2) ^ GETBYTE(seed, 3));
}
開發者ID:LjApps,項目名稱:eMule-VeryCD,代碼行數:14,代碼來源:rng.cpp

示例14: archive_fetch_data

uint64_t archive_fetch_data(int fd, int size)
{
	unsigned char data[8] = { 0 };
	uint64_t val = 0;

	if (read(fd, data, size) != size) {
		DPRINTF("Invalid data block\n");
		return (uint64_t)-1;
	}

	switch (size) {
		case 1:	val = GETBYTE(data);
			break;
		case 2:	val = GETWORD(data);
			break;
		case 4:	val = GETUINT32(data);
			break;
		case 8: val = GETUINT64(data);
			break;
		default:val = (uint64_t)-1;
			DPRINTF("Cannot get %d bytes: Not implemented\n", size);
			break;
	}

	return val;
}
開發者ID:MigNov,項目名稱:archiver,代碼行數:26,代碼來源:archive.c

示例15: GETDWORD

// Disconnect client from char/world server
bool CCharServer::pakLoginDSClient( CCharClient* thisclient, CPacket* P )
{
    unsigned int userid = GETDWORD((*P), 1 );
    CCharClient* otherclient = GetClientByUserID( userid );
    BYTE action = GETBYTE((*P),0);
    switch(action)
    {
        case 1:
        {
            if(otherclient==NULL)
            {
                Log( MSG_WARNING, "Userid '%u' is not online", userid );
                return true;
            }
            otherclient->isLoggedIn = false;
            otherclient->isActive = false;
            BEGINPACKET( pak, 0x502 );
            ADDBYTE    ( pak, 1 );
            ADDDWORD   ( pak, userid );
            //ADDBYTE    ( pak, 0x00 );
            //cryptPacket( (char*)&pak, NULL );
            CChanels* thischannel = GetChannelByID( otherclient->channel );
            if(thischannel!=NULL)
                send( thischannel->sock, (char*)&pak, pak.Size, 0 );
        }
        break;
    }
    return true;
}
開發者ID:boermansjo,項目名稱:KTRose_Server,代碼行數:30,代碼來源:charpackets.cpp


注:本文中的GETBYTE函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。