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

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

?? des.c

?? smartcard的des程序 加密方面的內容
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*
   This is a 'C' implementation of the National Bureau of Statistics
   Data Encryption Standard.

   All attempts have been made to use standard C facilities to maintain
   transportability.

   The DES procedure accepts 64-bits of data, 64-bits of key, an
   indication of whether the required function is an ENCRYPT or DECRYPT,
   and a 52 word work area.

   The output from the DES procedure is the data (which is now
   ENCRYPTed or DECRYPTed according to the input parameters).

   The work area is used for efficiency reasons, and may be used to avoid
   recalculating the subkeys if a single key is used repeatedly (as is the
   case in MAC processing).


   C Language Function Definition :

          DES( data, key, encode, work )

          unsigned int   data[4],
                         key[4],
                         encrypt,
                         work[52];

   where the following rules apply :

   in:     data        64 bits of data to be encrypted or decrypted. The most
                       significant byte is data[0]; the least significant byte
                       is data[3].
           key         64 bits of encryption key. This routine does not check
                       the parity of the key before using it; It is the
                       responsibility of the calling routine to ensure that the
                       key is in good working order.
           encrypt     FALSE (zero)     - selects a DECRYPT operation
                       TRUE  (non-zero) - selects an ENCRYPT operation
           work        This area is used to store the sub-keys for the supplied
                       key. If the same key is being used repeatedly, savings
                       can be made by eliminating the recalculation of the
                       sub-keys for each operation by passing the same work
                       area back to this function, without modifying any of the
                       work area between calls.

   out:    data        The output of the encryption or decryption process.
                       The original data is destroyed.
           key         Unchanged.
           encrypt     Unchanged.
           work        Contains the key and the subkeys from the operation
                       just performed.
                       NOTE: The work area should be zeroed if there is no need
                       to use the same key in the next operation (for security
                       reasons)
*/
/**/
/*
    Calling this routine from a C environment :

         A sample program is listed below :

*/
#include <stdio.h>

#define TRUE  -1
#define FALSE 0

#if 1
unsigned int key[] = { 0x0000, 0x0000, 0x0000, 0x0000 },
	     data[]= { 0x3131, 0x3131, 0x3131, 0x3131 },
	     work[52];

#endif
#if 0
unsigned int key[] = { 0x3131, 0x3131, 0x3131, 0x3131 },
	     data[]= { 0x3131, 0x3131, 0x3131, 0x3131 },
	     work[52];

#endif
#if 0
unsigned int key[] = { 0x0123, 0x4567, 0x89ab, 0xcdef },
	     data[]= { 0x4e6f, 0x7720, 0x6973, 0x2074 },
	     work[52];
#endif
void DES( unsigned int* text, unsigned int* key, unsigned int encrypt, unsigned int* work);

void ROL8(unsigned int* text)
{
    unsigned char t;

	t=text[0]>>8;
	text[0]=text[0]<<8|text[1]>>8;
	text[1]=text[1]<<8|text[2]>>8;
	text[2]=text[2]<<8|text[3]>>8;
	text[3]=text[3]<<8|t;
}

void ROR8(unsigned int* text)
{
    unsigned t;

	t=(text[3]&0xff)<<8;
	text[3]=text[3]>>8|text[2]<<8;
	text[2]=text[2]>>8|text[1]<<8;
	text[1]=text[1]>>8|text[0]<<8;
	text[0]=text[0]>>8|t;
}

void XOR(unsigned int* text1, unsigned int* text2)
{
	text1[0]=text1[0]^text2[0];
	text1[1]=text1[1]^text2[1];
	text1[2]=text1[2]^text2[2];
	text1[3]=text1[3]^text2[3];
}

void main (void)
{
  int i,j;
  char str[50];
  unsigned int RandA[] = {0x1212, 0x1212, 0x1212, 0x1212};
  unsigned int RandB[] = {0x0000, 0x0000, 0x0000, 0x0000};

  printf("Key=  %04X%04X%04X%04X\n", key[0], key[1], key[2], key[3]);
  printf("Data: ");
  gets(str);
  if (strlen(str)==16) {
	  for (i=0; i<4; i++) {
		j=3-i;
	    sscanf(&str[j*4],"%04x",data+j);
		str[j*4]='\0';
	  }
  }

#if 0
	printf("DES(RANDB)  =%04X%04X%04X%04X\n", data[0], data[1], data[2], data[3]);
	DES(data, key, FALSE, work);
	printf("      RANDB =%04X%04X%04X%04X\n", data[0], data[1], data[2], data[3]);
	ROL8(data);
	printf("ROL8(RANDB) =%04X%04X%04X%04X\n", data[0], data[1], data[2], data[3]);

	printf("RANDA=%04X%04X%04X%04X\n", RandA[0], RandA[1], RandA[2], RandA[3]);
	DES(RandA, key, TRUE, work);
	printf("block1=%04X%04X%04X%04X\n", RandA[0], RandA[1], RandA[2], RandA[3]);
	XOR(data,RandA);
	printf("XOR =%04X%04X%04X%04X\n", data[0], data[1], data[2], data[3]);
	DES(data, key, FALSE, work);
	printf("block2=%04X%04X%04X%04X\n", data[0], data[1], data[2], data[3]);
	printf("Challenge=%04X%04X%04X%04X%04X%04X%04X%04X\n",
		RandA[0], RandA[1], RandA[2], RandA[3],
		data[0], data[1], data[2], data[3]);

	printf("Response: ");
	gets(str);
	if (strlen(str)==16) {
		for (i=0; i<4; i++) {
			j=3-i;
			sscanf(&str[j*4],"%04x",data+j);
			str[j*4]='\0';
			}
	}
	DES(data, key, FALSE, work);
	printf("DES-1(RESP)=%04X%04X%04X%04X\n", data[0], data[1], data[2], data[3]);

#else

  printf( "   Plain Text          Cipher Text        Decipher text \n" );
  printf( "----------------    ----------------    ----------------\n" );

  printf( "%04X%04X%04X%04X    ", data[0], data[1], data[2], data[3] );

  DES( data, key, TRUE, work );

  printf( "%04X%04X%04X%04X    ", data[0], data[1], data[2], data[3] );

  DES( data, key, FALSE, work );
  DES( data, key, FALSE, work );

  printf( "%04X%04X%04X%04X\n", data[0], data[1], data[2], data[3] );
#endif
}
/*
     The output should look like


        Plain Text          Cipher Text        Decipher text
     ----------------    ----------------    ----------------
     4E6F772069732074    3FA40E8A984D4815    4E6F772069732074




   Calling this function from a non-C environment :

         In C, when an array is passed as an argument, the address of the
         start of the array is placed on the stack. When an int value is
         passed as a parameter, the value of that variable is placed on the
         stack.

         For this function, there will be three addresses ( for data, key,
         and work) and one value ( for encrypt ).

         It is necessary to establish exactly how the C compiler used to
         compile this function expects to see the parameters on the stack
         before being able to call this function from any non-C environment.


*/
/**/

/*
   Offsets to tranformation rules
 */
#define IP       0   /* Initial Permutation         64 * 64   */
#define IP_1    65   /* Inverse Initial Permutation 64 * 64   */
#define E      130   /* E Function                  32 * 48   */
#define P      179   /* P Function                  32 * 32   */
#define PC1A   212   /* Permutation Choice 1 - C0   64 * 28   */
#define PC1B   245   /* Permutation Choice 1 - D0   64 * 28   */
#define PC2    278   /* Permutation Choice 2        56 * 48   */

/*
   General defines
 */
#define TRUE  -1
#define FALSE 0

typedef unsigned char byte;     /* If not defined as standard */

/*
   The Microsoft C compiler will only support 8 parameters, so the
   tform macro has been split into two separate macros. The net effect
   is the same
 */
#define tform1(a,b,c,d,e,f,g,h)  a-1, b-1, c-1, d-1, e-1, f-1, g-1, h-1,
#define tform2(a,b,c,d,e,f,g,h)  a-1, b-1, c-1, d-1, e-1, f-1, g-1, h-1 | 0x80,

/**/
static byte rules[] =  {
/* 0    Initial Permutation             64 * 64            */
tform1( 58, 50, 42, 34, 26, 18, 10,  2)tform2( 60, 52, 44, 36, 28, 20, 12,  4)
tform1( 62, 54, 46, 38, 30, 22, 14,  6)tform2( 64, 56, 48, 40, 32, 24, 16,  8)
tform1( 57, 49, 41, 33, 25, 17,  9,  1)tform2( 59, 51, 43, 35, 27, 19, 11,  3)
tform1( 61, 53, 45, 37, 29, 21, 13,  5)tform2( 63, 55, 47, 39, 31, 23, 15,  7)
0xFF,
/* 65   Inverse Initial Permutation     64 * 64            */
tform1( 40,  8, 48, 16, 56, 24, 64, 32)tform2( 39,  7, 47, 15, 55, 23, 63, 31)
tform1( 38,  6, 46, 14, 54, 22, 62, 30)tform2( 37,  5, 45, 13, 53, 21, 61, 29)
tform1( 36,  4, 44, 12, 52, 20, 60, 28)tform2( 35,  3, 43, 11, 51, 19, 59, 27)
tform1( 34,  2, 42, 10, 50, 18, 58, 26)tform2( 33,  1, 41,  9, 49, 17, 57, 25)
0xFF,
/* 130  E Function                      32 * 48            */
tform1( 32,  1,  2,  3,  4,  5,  4,  5)tform2(  6,  7,  8,  9,  8,  9, 10, 11)
tform1( 12, 13, 12, 13, 14, 15, 16, 17)tform2( 16, 17, 18, 19, 20, 21, 20, 21)
tform1( 22, 23, 24, 25, 24, 25, 26, 27)tform2( 28, 29, 28, 29, 30, 31, 32,  1)
0xFF,
/* 179  P Function                      32 * 32            */
tform1( 16,  7, 20, 21, 29, 12, 28, 17)tform2(  1, 15, 23, 26,  5, 18, 31, 10)
tform1(  2,  8, 24, 14, 32, 27,  3,  9)tform2( 19, 13, 30,  6, 22, 11,  4, 25)
0xFF,
/* 212  Permutation Choice 1 - C0       64 * 28            */
tform1( 57, 49, 41, 33, 25, 17,  9,  1)tform2( 58, 50, 42, 34, 26, 18, 10,  2)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩欧美在线不卡| 人人狠狠综合久久亚洲| 亚洲国产日韩一级| 国产黄色成人av| 在线播放欧美女士性生活| 中文一区在线播放| 精品一二三四区| 欧美日韩国产免费一区二区| 国产精品传媒入口麻豆| 免费人成精品欧美精品| 欧美在线观看一区二区| 中文字幕不卡三区| 狠狠色伊人亚洲综合成人| 欧美日韩中文字幕一区二区| 亚洲日本免费电影| 国产成人一区在线| 久久综合久色欧美综合狠狠| 视频在线观看91| 欧美日本韩国一区二区三区视频| ●精品国产综合乱码久久久久| 久久97超碰国产精品超碰| 欧美精品九九99久久| 亚洲一卡二卡三卡四卡五卡| 成人性生交大片免费看中文 | 久久久久99精品国产片| 日韩va亚洲va欧美va久久| 欧美午夜一区二区三区免费大片| 亚洲丝袜另类动漫二区| 成人app网站| 国产精品伦理在线| 从欧美一区二区三区| 国产亚洲精品精华液| 国产一区二区在线观看视频| 26uuu欧美日本| 精品一二三四区| 久久久亚洲高清| 国产精品一区在线观看乱码| 久久久精品国产99久久精品芒果| 国产精品一区二区在线观看网站| 久久久精品一品道一区| 波多野结衣一区二区三区| 综合久久久久久| 色中色一区二区| 五月婷婷色综合| 精品国产凹凸成av人网站| 国产乱一区二区| 中国色在线观看另类| 色又黄又爽网站www久久| 亚洲精品久久7777| 欧美一区二区三区日韩视频| 精品无码三级在线观看视频| 国产女主播视频一区二区| 91一区二区三区在线播放| 一区二区三区日韩在线观看| 欧美色综合久久| 蜜臀av在线播放一区二区三区| 日韩欧美一区二区不卡| 国产久卡久卡久卡久卡视频精品| 国产精品色在线| 在线一区二区三区做爰视频网站| 日本成人在线网站| 国产精品无遮挡| 欧美性感一类影片在线播放| 六月丁香婷婷久久| 自拍偷拍国产亚洲| 3d动漫精品啪啪一区二区竹菊| 国产激情91久久精品导航| 亚洲免费色视频| 欧美一区二区三区视频在线观看| 国产成人精品影院| 亚洲h精品动漫在线观看| 久久综合色鬼综合色| 欧美中文字幕一区二区三区| 久久91精品久久久久久秒播| 亚洲人成精品久久久久久| 日韩欧美视频在线| 一道本成人在线| 久久精品国产亚洲aⅴ| 亚洲桃色在线一区| 久久这里只精品最新地址| 欧美日韩一区二区三区不卡| 国产.欧美.日韩| 免费成人美女在线观看.| 亚洲乱码一区二区三区在线观看| 91精品国产91久久久久久最新毛片| 懂色中文一区二区在线播放| 石原莉奈在线亚洲三区| 亚洲天堂网中文字| 久久精品人人做| 欧美精品久久一区| 91国产丝袜在线播放| 风间由美一区二区av101| 日本午夜精品视频在线观看| 亚洲综合在线五月| 国产精品久久久久久久浪潮网站| 日韩欧美精品三级| 欧美精品乱码久久久久久| 色婷婷国产精品久久包臀| 成人国产精品免费观看| 国产美女av一区二区三区| 蜜桃视频一区二区| 日本成人超碰在线观看| 亚洲国产欧美日韩另类综合| 日本一区二区不卡视频| 久久人人爽爽爽人久久久| 日韩一级成人av| 欧美老肥妇做.爰bbww| 色哟哟一区二区| 97久久人人超碰| 99久久国产综合精品色伊| 不卡视频在线观看| 国产成a人亚洲| 大胆亚洲人体视频| 国产成人免费视频| 成人免费观看av| 不卡欧美aaaaa| 成人黄色免费短视频| 成人av片在线观看| 99久久精品国产导航| 91色porny蝌蚪| 一本久道久久综合中文字幕| 色婷婷精品大视频在线蜜桃视频| 91女厕偷拍女厕偷拍高清| 91网页版在线| 色一情一伦一子一伦一区| 91麻豆国产福利精品| 欧美色综合天天久久综合精品| 欧美三级日韩三级| 91精品国产综合久久蜜臀| 91精品国产麻豆国产自产在线| 91精品国产色综合久久ai换脸 | 亚洲电影一区二区三区| 亚洲专区一二三| 日韩 欧美一区二区三区| 精品一区二区三区欧美| 成人精品鲁一区一区二区| 99re在线精品| 欧美军同video69gay| 2022国产精品视频| 国产精品久久三区| 亚洲综合另类小说| 久久精品国产精品亚洲综合| 福利一区二区在线观看| 色综合久久88色综合天天| 91超碰这里只有精品国产| 精品国产1区2区3区| 国产精品成人免费| 香港成人在线视频| 国产真实乱对白精彩久久| 波波电影院一区二区三区| 欧美日韩精品专区| 中文字幕乱码一区二区免费| 亚洲裸体xxx| 久久成人av少妇免费| 91在线视频观看| 日韩视频在线你懂得| 国产精品久久久久影院亚瑟| 亚洲综合999| 国产乱码字幕精品高清av| 色综合久久中文字幕综合网| 日韩一区二区免费高清| 亚洲欧洲日韩在线| 美女任你摸久久| 色噜噜狠狠色综合欧洲selulu | 欧美年轻男男videosbes| 久久日韩粉嫩一区二区三区| 亚洲成人免费看| 成人免费视频网站在线观看| 7777精品久久久大香线蕉| 国产精品色噜噜| 精品一区二区三区视频在线观看| 欧洲另类一二三四区| 国产精品久久久久久久久久免费看 | 日韩电影免费在线观看网站| 国产不卡一区视频| 日韩一区二区三区在线视频| 亚洲自拍偷拍麻豆| 成人毛片在线观看| 久久久不卡影院| 免费黄网站欧美| 欧美综合色免费| 中文字幕亚洲综合久久菠萝蜜| 国内久久精品视频| 日韩一区二区三区三四区视频在线观看 | 97久久久精品综合88久久| 欧美精品一区二| 日本麻豆一区二区三区视频| 欧美性大战久久| 亚洲一区二区免费视频| 9i看片成人免费高清| 亚洲国产经典视频| 国产一区二区不卡| 日韩免费高清av| 老司机精品视频导航| 日韩欧美国产综合| 午夜精品福利视频网站| 欧美日韩午夜在线| 亚洲一区二区3| 欧美区一区二区三区| 一区二区欧美在线观看|