440,506 Members | 1,881 Online
Need help? Post your question and get tips & solutions from a community of 440,506 IT Pros & Developers. It's quick & easy.

# what the meaning of this?

 P: n/a anyone know is it this source code value:- T = ((Y >> 4) ^ X) & 0x0F0F0F0F; X ^= T; Y ^= (T << 4); T = ((Y ) ^ X) & 0x10101010; X ^= T; Y ^= (T ); X = (LHs[ (X ) & 0xF] << 3) | (LHs[ (X >> 8) & 0xF ] << 2) | (LHs[ (X >> 16) & 0xF] << 1) | (LHs[ (X >> 24) & 0xF ] ) | (LHs[ (X >> 5) & 0xF] << 7) | (LHs[ (X >> 13) & 0xF ] << 6) | (LHs[ (X >> 21) & 0xF] << 5) | (LHs[ (X >> 29) & 0xF ] << 4); Y = (RHs[ (Y >> 1) & 0xF] << 3) | (RHs[ (Y >> 9) & 0xF ] << 2) | (RHs[ (Y >> 17) & 0xF] << 1) | (RHs[ (Y >> 25) & 0xF ] ) | (RHs[ (Y >> 4) & 0xF] << 7) | (RHs[ (Y >> 12) & 0xF ] << 6) | (RHs[ (Y >> 20) & 0xF] << 5) | (RHs[ (Y >> 28) & 0xF ] << 4); X &= 0x0FFFFFFF; Y &= 0x0FFFFFFF; same as the PC-1 table value? PC-1 57 49 41 33 25 17 9 1 58 50 42 34 26 18 10 2 59 51 43 35 27 19 11 3 60 52 44 36 63 55 47 39 31 23 15 7 62 54 46 38 30 22 14 6 61 53 45 37 29 21 13 5 28 20 12 4 and how to compare both? Mar 3 '06 #1
7 Replies

 P: n/a In article <11*********************@z34g2000cwc.googlegroups. com>, newbie wrote:anyone know is it this source code value:- T = ((Y >> 4) ^ X) & 0x0F0F0F0F; X ^= T; Y ^= (T << 4); T = ((Y ) ^ X) & 0x10101010; X ^= T; Y ^= (T ); X = (LHs[ (X ) & 0xF] << 3) | (LHs[ (X >> 8) & 0xF ] << 2) | (LHs[ (X >> 16) & 0xF] << 1) | (LHs[ (X >> 24) & 0xF ] ) You have not shown us the definition of LHs or RHs, so we cannot tell you what this expression produces. same as the PC-1 table value? PC-1 57 49 41 33 25 17 9 1 58 50 42 34 26 18 10 2 59 51 43 35 27 19 11 3 60 52 44 36 63 55 47 39 31 23 15 7 62 54 46 38 30 22 14 6 61 53 45 37 29 21 13 5 28 20 12 4 and how to compare both? The code involves two input variables, X and Y, of at least 29 bits, and calculates 3 values, T, X, and Y. T could plausibly be a temporary value, but the structure of the code shows that X and Y are both outputs. You ask that this output be compared to a single table, apparently of size 8 x 7, or perhaps 2 x 4 x 7, and whose values appear to be 6 bits wide. Even if we interpret the empty line as indicating two output tables, one for X and the other for Y, we have a dimensionality clash: the output of an operation upon a 29+ bit value cannot be less than 2^29th values [even if all the rest of them turn out to be 0] and a single variable of output cannot be compared to a 4 x 7 table of outputs without a mapping function... and no mapping function has been defined. Hence, no matter what the arithmetic produces, we can deduce that it does -not- produce the table we are asked to compare against. [Thus we do not need to analyze the bit-manipulation logic to produce the definite answer "NO".] -- "law -- it's a commodity" -- Andrew Ryan (The Globe and Mail, 2005/11/26) Mar 3 '06 #2

 P: n/a the RH and LH as below:- static uint32 LHs[16] = { 0x00000000, 0x00000001, 0x00000100, 0x00000101, 0x00010000, 0x00010001, 0x00010100, 0x00010101, 0x01000000, 0x01000001, 0x01000100, 0x01000101, 0x01010000, 0x01010001, 0x01010100, 0x01010101 }; static uint32 RHs[16] = { 0x00000000, 0x01000000, 0x00010000, 0x01010000, 0x00000100, 0x01000100, 0x00010100, 0x01010100, 0x00000001, 0x01000001, 0x00010001, 0x01010001, 0x00000101, 0x01000101, 0x00010101, 0x01010101, }; so what the expression produce? Mar 5 '06 #3