|
![]() | 作者: cloret [cloret]
![]() |
登录 |
static unsigned short bytebit[8] = { 0200, 0100, 040, 020, 010, 04, 02, 01 }; /* Use the key schedule specified in the Standard (ANSI X3.92-1981). */ static unsigned char pc1[56] = { 56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 60, 52, 44, 36, 28, 20, 12, 4, 27, 19, 11, 3 }; static unsigned char totrot[16] = { 1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28 }; void deskey(key, edf) unsigned char *key; short edf; { register int i, j, l, m, n; unsigned char pc1m[56], pcr[56]; unsigned long kn[32]; for ( j = 0; j < 56; j++ ) { l = pc1[j]; m = l & 07; pc1m[j] = (key[l >> 3] & bytebit[m]) ? 1 : 0; } ......................... } 这是数据加密标准的一段源程序 这段功能是实现密匙置换 我想问一下 pclm[j] = (key[1 >> 3] & bytebit[m] ? 1: 0; 是什么意思 其中key []在main()为 char key[8] = {0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef}; 麻烦各位帮帮忙!! |
地主 发表时间: 06/18 20:10 |
![]() | 回复: oyiboy [oyiboy] ![]() |
登录 |
pclm[j] = (key[1 >> 3] & bytebit[m] ? 1: 0; ?:是if ... else ...的快捷方式 即是当(key[1 >> 3] & bytebit[m]=true是返回1,反之返回0 |
B1层 发表时间: 06/19 11:29 |
![]() | 回复: 286 [unique] ![]() |
登录 |
pclm[j] = (key[1 >> 3] & bytebit[m] ? 1: 0; l>>3 等价于 l=l/8 pclm[j]=(key[1 >> 3] & bytebit[m] ? 1: 0等价于 if ((key[l>>3] & bytebit[m]) == true) pclm[j]=1; else pclm[j]=0; |
B2层 发表时间: 06/19 18:02 |
|
20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon
粤ICP备05087286号