How does the nonlinear function of KeeLoq work?

I want to know how the nonlinear function of KeeLoq works.

Here at Wikipedia it says that:

The NLFSR feedback function is 0x3A5C742E

I understand that F(a,b,c,d,e) = 3A5C742E.

Now, he did not say anything about encoding of a, b, c, d, e. I consider them as in ASCII. But each letter will have 8-bit. So total would be 40. Could someone explains to me how to compute this function or what is the encoding scheme of a, b, c, d, e in order to apply Karnaugh map?

• The $a,\ldots,e$ are bits, see below. Nov 28 '17 at 5:35

1 Answer

Suppose you want to compute $F(0,0,0,1,0)$, then note that $00010_2 = 2_{10}$ so the result is bit $2$ (counted from $0$ from right to left) of 0x3A5C742E, or in C terms just (3A5C742E >> 2) & 1 = 1 This is the standard convention when encoding such Boolean functions.

As another example F(1,1,1,1,1) = (0x3A5C742E >> 31) & 1 = 0 as $11111_2 = 31_{10}$ etc.

• It extracts the bits from a constant? Nov 28 '17 at 5:18
• @Melab the constant is just the 32 values for the 32 different inputs. It’s a compact table. Nov 28 '17 at 5:20
• Elaborate, please. Nov 28 '17 at 5:24
• @Melab Read the answer, it explains. Nov 28 '17 at 5:28
• @HennoBrandsma Thank you Henno, It is clear now. another example also F(1,0,0,0,0)=0. Nov 28 '17 at 6:07