亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? idea.c

?? IP網(wǎng)絡語音通訊軟件源代碼. 不可多得的語音源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
		cmp  si, [done8]
		jne  LLloop
		jmp  LLout8

;------------------------------------------
; Special case multiplications, when one factor is 0

LLx1:	mov  ax, 1
		sub  ax, [sx1]
		sub  ax, [Word ptr si]
		jmp  LLx1out

LLkk:	mov  ax, [sx1]		 ; rebuild overwritten operand
		xor  ax, bx
		neg  ax
		inc  ax
		sub  ax, [si+8]
		jmp  LLkkout

LLx4:	mov  ax, 1
		sub  ax, [sx4]
		sub  ax, [Word ptr si+6]
		jmp  LLx4out

LLt1:	mov  ax, [sx4]		 ; rebuild
		xor  ax, di
		add  ax, cx
		neg  ax
		inc  ax
		sub  ax, [si+10]
		jmp  LLt1out

;---------------------------------------------------
;	8 rounds are done, now that extra pseudo-round

LLout8:
		push di
		mov  di, [outblock]

		mul  [Word ptr si]
		sub  ax, dx
		jnz  LLo1n			 ; jump over special case code
		mov  ax, 1
		sub  ax, [sx1]
		sub  ax, [si]
		jmp  LLo1out
LLo1n:	adc  ax, 0
LLo1out:  mov [di], ax		 ; final ciphertext block 1

		mov  ax, [sx4]
		mul  [Word ptr si+6]
		sub  ax, dx
		jnz  LLo4n			 ; jump over special case code
		mov  ax, 1
		sub  ax, [sx4]
		sub  ax, [si+6]
		jmp  LLo4out
LLo4n:	adc  ax, 0
LLo4out: mov  [di+6], ax	 ; final ciphertext block 4

		add  bx, [si+2]
		mov  [di+2], bx 	 ; final ciphertext block 2
		pop  ax
		add  ax, [si+4]
		mov  [di+4], ax 	 ; final ciphertext block 3

;  Restore the stack and return

		pop  di
		pop  si
;		pop  dx
;		pop  cx
;		pop  bx
;		pop  ax
	}
}

#else

/* IDEA encryption/decryption algorithm. In/out can be the same buffer */ 

static void cipher_idea(word16 FAR *in, word16 FAR *out, register CONST IDEAkey Z)
{
	   register uint16 x1, x2, x3, x4, t1, t2;
	   register uint16 t16;
	   register word32 t32;
	   int r = ROUNDS;
	   x1 = *in++;	x2 = *in++;
	   x3 = *in++;	x4 = *in;
	   do
	   {
			 MUL(x1,*Z++);
			 x2 += *Z++;
			 x3 += *Z++;
			 MUL(x4, *Z++);
			 t2 = x1^x3;
			 MUL(t2, *Z++);
			 t1 = t2 + (x2^x4);
			 MUL(t1, *Z++);
			 t2 = t1+t2;
			 x1 ^= t1;
			 x4 ^= t2; 
			 t2 ^= x2;
			 x2 = x3^t1;
			 x3 = t2;
	   } while (--r);
	   MUL(x1, *Z++);
	   *out++ = x1;
	   *out++ = x3 + *Z++;
	   *out++ = x2 + *Z++;
	   MUL(x4, *Z);
	   *out = x4;
}
#endif

#ifdef TEST

/* Number of Kbytes of test data to encrypt. Defaults to 1 MByte. */

#ifndef KBYTES
#define KBYTES 1024
#endif

#ifndef CLOCKS_PER_SEC
#define CLOCKS_PER_SEC 1000000
#endif

int main()
{	   /* Test driver for IDEA cipher */ 
	   int i, j, k; 
	   IDEAkey Z, DK;
	   word16 XX[4], TT[4], YY[4];	   
	   word16 userkey[8];
	   clock_t start, end;
	   long l;

	   /* Make a sample user key for testing... */

	   for(i=0; i<8; i++)
			 userkey[i] = i+1;

	   /* Compute encryption subkeys from user key... */

	   en_key_idea(userkey,Z);
       printf("\nEncryption key subblocks: ");
	   for(j=0; j<ROUNDS+1; j++)
	   {
             printf("\nround %d:   ", j+1);
			 if (j==ROUNDS)
					for(i=0; i<4; i++)
                          printf(" %6u", Z[j*6+i]);
			 else
					for(i=0; i<6; i++)
                          printf(" %6u", Z[j*6+i]);
	   }

	   /* Compute decryption subkeys from encryption subkeys... */

	   de_key_idea(Z,DK);
       printf("\nDecryption key subblocks: ");
	   for(j=0; j<ROUNDS+1; j++)
	   {
             printf("\nround %d:   ", j+1);
			 if (j==ROUNDS)
					for(i=0; i<4; i++)
                          printf(" %6u", DK[j*6+i]);
			 else
					for(i=0; i<6; i++)
                          printf(" %6u", DK[j*6+i]);
	   }

	   /* Make a sample plaintext pattern for testing... */

	   for (k=0; k<4; k++)
			 XX[k] = k;
       printf("\n Encrypting %d KBytes (%ld blocks)...", KBYTES, KBYTES*64l);
	   fflush(stdout);
	   start = clock();
	   cipher_idea(XX,YY,Z);		 /* encrypt plaintext XX, making YY */ 
	   for (l = 1; l < 64*KBYTES; l++)
			 cipher_idea(YY,YY,Z);	 /* repeated encryption */
	   cipher_idea(YY,TT,DK);		 /* decrypt ciphertext YY, making TT */ 
	   for (l = 1; l < 64*KBYTES; l++)
			 cipher_idea(TT,TT,DK);  /* repeated decryption */
	   end = clock() - start;
	   l = end * 1000. / CLOCKS_PER_SEC + 1;
	   i = l/1000;
	   j = l%1000;
	   l = KBYTES * 1024. * CLOCKS_PER_SEC / end;

       printf("%d.%03d seconds = %ld bytes per second\n", i, j, l);
       printf("\nX %6u   %6u  %6u  %6u \n",    
		 XX[0], XX[1],	XX[2], XX[3]);
       printf("Y %6u   %6u  %6u  %6u \n",
		 YY[0], YY[1],	YY[2], YY[3]);
       printf("T %6u   %6u  %6u  %6u \n",
		 TT[0], TT[1],	TT[2], TT[3]);
	   /* Now decrypted TT should be same as original XX */
	   for (k=0; k<4; k++)
			 if (TT[k] != XX[k])
			 {
                    printf("\n\07Error!  Noninvertable encryption.\n");
					exit(-1);	   /* error exit */ 
			 }
       printf("\nNormal exit.\n");
	   return 0;
}
#endif /* TEST */

/* xorbuf - change buffer via xor with random mask block. Used for Cipher 
 * Feedback (CFB) or Cipher Block Chaining (CBC) modes of encryption. Can be
 *	applied for any block encryption algorithm, with any block size, such as 
 * the DES or the IDEA cipher.	*/

static void xorbuf(register byteptr buf, register byteptr mask, register int count)
/*	   count must be > 0 */
{
	   if (count) 
			 do
					*buf++ ^= *mask++;
			 while (--count);
}	   /* xorbuf */

/* cfbshift - shift bytes into IV for CFB input. Used only for Cipher Feedback
 * (CFB) mode of encryption. Can be applied for any block encryption algorithm
 * with any block size, such as the DES or the IDEA cipher.  */

static void cfbshift(register byteptr iv, register byteptr buf, register int count, int blocksize)
/* iv is initialization vector. buf is buffer pointer. count is number of bytes
 * to shift in...must be > 0. blocksize is 8 bytes for DES or IDEA ciphers. */
{
	   int retained;
	   if (count)
	   {
			 retained = blocksize-count;   /* number bytes in iv to retain */
		 /* left-shift retained bytes of IV over by count bytes to make room */
			 while (retained--)
			 {
					*iv = *(iv+count);
					iv++;
			 }
			 /* now copy count bytes from buf to shifted tail of IV */
			 do 	*iv++ = *buf++;
			 while (--count);
	   }
}	   /* cfbshift */

/* Key schedules for IDEA encryption and decryption */

static IDEAkey Z, DK;
static word16 FAR *iv_idea; 	/* pointer to IV for CFB or CBC */
static boolean cfb_dc_idea;		/* TRUE iff CFB decrypting */

/* initkey_idea initializes IDEA for ECB mode operations */

void initkey_idea(byte FAR *key, boolean decryp)
{
	   word16 userkey[8]; /* IDEA key is 16 bytes long */
	   int i;
	   /* Assume each pair of bytes comprising a word is ordered MSB-first. */
	   for (i=0; i<8; i++)
	   {
			 userkey[i] = (key[0]<<8) + key[1];
			 key++; key++;
	   }
	   en_key_idea(userkey,Z);
	   if (decryp)
	   {
			 de_key_idea(Z,Z);	 /* compute inverse key schedule DK */
	   }
	   for (i=0; i<8; i++)/* Erase dangerous traces */
			 userkey[i] = 0;
} /* initkey_idea */

/* Run a 64-bit block thru IDEA in ECB (Electronic Code Book) mode, using the
 * currently selected key schedule. */

void idea_ecb(word16 FAR *inbuf, word16 FAR *outbuf)
{
	   /* Assume each pair of bytes comprising a word is ordered MSB-first. */
#ifndef HIGHFIRST	/* If this is a least-significant-byte-first CPU */
	   word16 x;
	   /* Invert the byte order for each 16-bit word for internal use. */
	   x = inbuf[0]; outbuf[0] = x >> 8 | x << 8;
	   x = inbuf[1]; outbuf[1] = x >> 8 | x << 8;
	   x = inbuf[2]; outbuf[2] = x >> 8 | x << 8;
	   x = inbuf[3]; outbuf[3] = x >> 8 | x << 8;
	   cipher_idea(outbuf, outbuf, Z);
	   x = outbuf[0]; outbuf[0] = x >> 8 | x << 8;
	   x = outbuf[1]; outbuf[1] = x >> 8 | x << 8;
	   x = outbuf[2]; outbuf[2] = x >> 8 | x << 8;
	   x = outbuf[3]; outbuf[3] = x >> 8 | x << 8;
#else  /* HIGHFIRST */
	   /* Byte order for internal and external representations is the same. */
	   cipher_idea(inbuf, outbuf, Z);
#endif /* HIGHFIRST */
} /* idea_ecb */

/* initcfb - Initializes IDEA key schedule tables via key; initializes Cipher
 * Feedback mode IV. References context variables cfb_dc_idea and iv_idea.	*/

void initcfb_idea(word16 FAR *iv0, byte FAR *key, boolean decryp)
/* iv0 is copied to global iv_idea, buffer will be destroyed by ideacfb. key is
 * pointer to key buffer. decryp is TRUE if decrypting, FALSE if encrypting. */
{
	   iv_idea = iv0;
	   cfb_dc_idea = decryp;
	   initkey_idea(key,FALSE);
}

/* ideacfb - encipher a buffer with IDEA enciphering algorithm, using Cipher
 *	Feedback (CFB) mode. Assumes initcfb_idea has already been called. 
 * References context variables cfb_dc_idea and iv_idea.  */

void ideacfb(byteptr buf, int count)
/* buf is input, output buffer, may be more than 1 block. count is byte count
 * is byte count of buffer.  May be > IDEABLOCKSIZE. */
{
	   int chunksize;				 /* smaller of count, IDEABLOCKSIZE */
	   word16 temp[IDEABLOCKSIZE/2];

	   while ((chunksize = min(count,IDEABLOCKSIZE)) > 0)
	   {
			 idea_ecb(iv_idea,temp);  /* encrypt iv_idea, making temp. */ 
			 if (cfb_dc_idea)/* buf is ciphertext */
					/* shift in ciphertext to IV... */
					cfbshift((byte FAR *)iv_idea,buf,chunksize,IDEABLOCKSIZE);
			 /* convert buf via xor */
			 xorbuf(buf,(byte *)temp,chunksize);/* buf has enciphered output */
			 if (!cfb_dc_idea)/* buf was plaintext, is now ciphertext */
					/* shift in ciphertext to IV... */
					cfbshift((byte FAR *)iv_idea,buf,chunksize,IDEABLOCKSIZE);
			 count -= chunksize;
			 buf += chunksize;
	   }
}

/* close_idea function erases all the key schedule information when we are 
 * done with a set of operations for a particular IDEA key context. This is to
 * prevent any sensitive data from being left around in memory. */

void close_idea(void)		/* erase current key schedule tables */
{
	   short i;
	   for (i = 0; i < KEYLEN; i++)
			 Z[i] = 0;
}	   /* close_idea() */

/* These buffers are used by init_idearand, idearand, and close_idearand. */
static word16 dtbuf_idea[4] = {0};	   /* buffer for enciphered timestamp */
static word16 randseed_idea[4] = {0};  /* seed for IDEA random # generator */
static word16 randbuf_idea[4] = {0};   /* buffer for IDEA random # generator */
static byte randbuf_idea_counter = 0;  /* random bytes left in randbuf_idea */

/* init_idearand - initialize idearand, IDEA random number generator. Used for
 *	generating cryptographically strong random numbers. Much of design comes 
 * from Appendix C of ANSI X9.17. key is pointer to IDEA key buffer. seed is 
 * pointer to random number seed buffer. tstamp is a 32-bit timestamp */

void init_idearand(byte key[16], byte seed[8], word32 tstamp)
{
	   int i;
	   initkey_idea(key, FALSE);	  /* initialize IDEA */
	   for (i=0; i<4; i++)			  /* capture timestamp material */
	   {	 dtbuf_idea[i] = (word16) tstamp;  /* get bottom word */
			 tstamp = tstamp >> 16;   /* drop bottom word */
			 /* tstamp has only 4 bytes-- last 4 bytes will always be 0 */
	   }
	   /* Start with enciphered timestamp: */
	   idea_ecb(dtbuf_idea,dtbuf_idea);
	   /* initialize seed material */
	   for (i=0; i<8; i++)
			 ((byte *)randseed_idea)[i] = seed[i];
	   randbuf_idea_counter = 0; /* # of random bytes left in randbuf_idea */
}

/* idearand - IDEA pseudo-random number generator. Used for generating 
 * cryptographically strong random numbers. Much of design comes from Appendix
 * C of ANSI X9.17.  */

byte idearand(void)
{
	   int i;
	   if (randbuf_idea_counter==0) 		/* if random buffer is spent...*/
	   {	 /* Combine enciphered timestamp with seed material: */
			 for (i=0; i<4; i++)
					randseed_idea[i] ^= dtbuf_idea[i];
			 idea_ecb(randseed_idea,randbuf_idea);	 /* fill new block */
			 /* Compute new seed vector: */
			 for (i=0; i<4; i++)
					randseed_idea[i] = randbuf_idea[i] ^ dtbuf_idea[i];
			 idea_ecb(randseed_idea,randseed_idea);    /* fill new seed */
			 randbuf_idea_counter = 8;	 /* reset counter for full buffer */
	   }
	   /* Take a byte from randbuf_idea: */
	   return(((byte *)randbuf_idea)[--randbuf_idea_counter]);
}

void close_idearand(void)
{	   /* Erase random IDEA buffers and wipe out IDEA key info */
	   int i;
	   for (i=0; i<4; i++)
	   {	 randbuf_idea[i] = 0;
			 randseed_idea[i] = 0;
			 dtbuf_idea[i] = 0;
	   }
	   close_idea();/* erase current key schedule tables */
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产亚洲在线| 免费看日韩精品| 日本不卡不码高清免费观看| 成人一区二区三区中文字幕| 欧美日韩高清在线| **欧美大码日韩| 久久超碰97人人做人人爱| 欧美在线观看视频在线| 国产精品免费观看视频| 免费日韩伦理电影| 欧美日本韩国一区| 一级特黄大欧美久久久| 成人av在线影院| 精品播放一区二区| 亚洲一区二区三区不卡国产欧美| 国产东北露脸精品视频| 欧美成人激情免费网| 青青青伊人色综合久久| 911精品国产一区二区在线| 亚洲精品日产精品乱码不卡| 成人av在线播放网址| 欧美激情一区二区三区在线| 国内精品国产三级国产a久久| 欧美日本一区二区| 香蕉影视欧美成人| 欧美性生活影院| 一区二区三区精品在线| 色猫猫国产区一区二在线视频| 国产精品第五页| 成人午夜电影网站| 中文字幕一区二区三区av| 成人国产一区二区三区精品| 中国色在线观看另类| 国产成人aaa| 中文字幕在线播放不卡一区| av不卡免费在线观看| 亚洲人成伊人成综合网小说| 色哟哟欧美精品| 亚洲va欧美va人人爽| 91精品国产高清一区二区三区 | 精品一区二区三区在线观看国产 | 久久国产麻豆精品| 日韩欧美一级二级三级久久久| 老司机午夜精品| 久久久综合精品| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 日韩一级欧美一级| 蜜桃一区二区三区在线| 欧美成人精品1314www| 国产大陆精品国产| 亚洲女同女同女同女同女同69| 色婷婷综合久久久中文字幕| 亚洲福利一区二区三区| 日韩一区二区三区免费看| 国产成人精品亚洲午夜麻豆| 亚洲人成小说网站色在线| 欧美三级韩国三级日本一级| 美女视频一区在线观看| 国产午夜精品一区二区三区嫩草 | 最新国产の精品合集bt伙计| 91免费看视频| 蜜桃视频免费观看一区| 国产视频一区在线观看| 色哟哟亚洲精品| 久久成人av少妇免费| 亚洲视频一二三| 日韩视频一区在线观看| 99精品在线免费| 免费视频一区二区| 亚洲人成网站精品片在线观看| 555www色欧美视频| av亚洲产国偷v产偷v自拍| 天堂久久一区二区三区| 中文字幕的久久| 日韩视频永久免费| 日本乱人伦一区| 精品一区二区国语对白| 一区二区三区欧美| 久久久久久久久久久99999| 日本韩国一区二区| 风间由美一区二区av101| 日韩专区在线视频| 亚洲欧美日韩人成在线播放| 日韩亚洲欧美高清| 91福利国产成人精品照片| 国产福利精品一区| 另类小说图片综合网| 亚洲综合丝袜美腿| 国产精品美女视频| xfplay精品久久| 欧美一区二区性放荡片| 色婷婷香蕉在线一区二区| 国产乱子伦一区二区三区国色天香| 亚洲乱码中文字幕| 国产精品美女久久久久久久久| 欧美哺乳videos| 欧美日韩久久一区| 91福利精品第一导航| 91麻豆产精品久久久久久| 高清不卡一二三区| 国产一区二区毛片| 成人高清免费在线播放| 欧美大片顶级少妇| 成人性生交大合| 99久久精品国产一区二区三区| 色综合久久中文字幕综合网| 国产精品全国免费观看高清| 一本久久a久久精品亚洲| 日本不卡不码高清免费观看| 国产精品区一区二区三| 欧美男人的天堂一二区| 国产白丝网站精品污在线入口| 亚洲欧美激情小说另类| 欧美大片顶级少妇| 欧美在线小视频| 国产suv精品一区二区6| 午夜电影网一区| 国产精品麻豆久久久| 欧美一区二区三区免费在线看| 成人av电影在线| 蜜桃精品视频在线观看| 亚洲男人电影天堂| 久久天堂av综合合色蜜桃网| 在线看一区二区| 成人黄动漫网站免费app| 精一区二区三区| 亚洲综合清纯丝袜自拍| 中文字幕av一区二区三区高 | 日本vs亚洲vs韩国一区三区二区 | 亚洲狠狠爱一区二区三区| 中文字幕免费在线观看视频一区| 欧美一级免费大片| 欧美性色欧美a在线播放| 懂色av一区二区三区蜜臀| 美国三级日本三级久久99| 亚洲国产视频直播| 亚洲另类在线制服丝袜| 国产精品天美传媒| 国产女人18水真多18精品一级做| 在线播放亚洲一区| 欧美三级乱人伦电影| 色久优优欧美色久优优| 不卡区在线中文字幕| 懂色av中文一区二区三区| 狠狠久久亚洲欧美| 老司机精品视频在线| 乱一区二区av| 精品一区二区在线观看| 久久91精品久久久久久秒播| 免费精品99久久国产综合精品| 五月天中文字幕一区二区| 亚洲国产中文字幕| 亚洲精品免费播放| 一区二区三区资源| 亚洲综合在线观看视频| 最好看的中文字幕久久| 亚洲激情图片qvod| 亚洲一区二区四区蜜桃| 同产精品九九九| 久久电影国产免费久久电影| 国产在线精品免费av| 成人免费毛片a| 一本久道久久综合中文字幕| 在线视频一区二区三| 欧美日韩久久一区二区| 日韩一区二区三区免费观看| 亚洲精品一区二区三区精华液| 久久九九全国免费| 国产精品久久久久久久第一福利| 亚洲日本免费电影| 亚洲国产精品久久久久婷婷884| 日韩一区欧美二区| 国产一区二区精品久久99| www.久久久久久久久| 在线观看视频一区二区| 欧美电视剧在线看免费| 欧美—级在线免费片| 最好看的中文字幕久久| 日韩精品一级二级 | 久久er精品视频| www.成人在线| 日韩色视频在线观看| 国产欧美精品一区aⅴ影院| 亚洲激情图片qvod| 国精产品一区一区三区mba视频| 高清免费成人av| 欧美日韩精品免费观看视频| 国产夜色精品一区二区av| 亚洲欧美日韩久久精品| 久久福利视频一区二区| 91福利精品第一导航| 精品国产伦一区二区三区免费| 亚洲色图视频网站| 久久超碰97人人做人人爱| 99精品在线免费| 久久久另类综合| 午夜欧美在线一二页| 99精品视频在线播放观看| 日韩免费高清av| 午夜精品一区二区三区电影天堂|