Return 混淆函数的值

Return value of obfuscation function

我正在尝试查找此函数的 return 值:

char __slp_f1tb1t(char x) {


const static unsigned char _[2][2][2][2] = {


{ { { 0x00, 0x10 }, { 0x20, 0x30 } },


{ { 0x40, 0x50 }, { 0x60, 0x70 } } },


{ { { 0x80, 0x90 }, { 0xA0, 0xB0 } }, 


{ { 0xC0, 0xD0 }, { 0xE0, 0xF0 } } }


};

return _[!!(x&0x80)][!!(x&0x40)][!!(x&0x20)][!!(x&0x10)] | (x&15); 

}

我应该如何进行?我想我不明白 char _[2][2][2][2] 是什么意思。

来自 standard

An identifier is a sequence of nondigit characters (including the underscore _, the lowercase and uppercase Latin letters, and other characters) and digits, which designates one or more entities as described in 6.2.1. Lowercase and uppercase letters are distinct. There is no specific limit on the maximum length of an identifier.

是的,这是一个有效的标识符名称。这是 4d 数组。

那么这里还做了什么 - 让我们一步一步来。如果 _ 是数组,那么 [] 中的那些是它的索引。

那么 ! 是什么?来自 standard

The result of the logical negation operator ! is 0 if the value of its operand compares unequal to 0, 1 if the value of its operand compares equal to 0. The result has type int. The expression !E is equivalent to (0==E).

所以它导致索引的值将 0,1。嗯,没错,这个多维数组中的所有数组的大小都是 2。所以没关系 - 我们可以使用 01.

访问所有元素

x 是一个字符 - sizeof char1- 1 字节。

x [0 0 0 0 1 0 1 0]

现在你这样做 x&0x80 这只不过是 And 使用 0x80 - 1 0 0 0 0 0 0 0 的结果。

所以基本上检查各个数字并将其与 char 变量的值进行或运算。

为什么 char 变量的值 - 不是 x&15 吗?

15 (0x0F) 是 0000 1111 并且将它们与 x 的任何值相加将导致最后 4 位 (LSB) x