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?

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

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.