I have a question about an old thread: Code: forums.mydigitallife.net/threads/35723-C-Compatible-Windows-8-Product-Key-Decoder First of all, the code in that thread works correctly, I'm not disputing that. My question is about these two lines: Code: // Check if Windows 8/Office 2013 Style Key (Can contain the letter "N") int containsN = (digitalProductId[keyStartIndex + 14] >> 3) & 1; digitalProductId[keyStartIndex + 14] = (byte)((digitalProductId[keyStartIndex + 14] & 0xF7) | ((containsN & 2) << 2)); Or in a simplified form: Code: byte b = ..; int containsN = (b >> 3) & 1; b = (byte)((b & 0xF7) | ((containsN & 2) << 2)); First (b >> 3) & 1 checks whether the 4th bit in b is set. Then b = b & 0xF7 sets the 4th bit to 0 But what is the meaning of | ((containsN & 2) << 2) ? containsN is either 1 or 0. 1&2=0 and 0&2=0 0<<2 = 0 x|0 = x So this piece seems to have no meaning? I could be wrong or I could be missing something, but this has been bothering me for some time now so if someone could clarify that would be great. Thanks
I know what ContainsN is for, I'm just confused about the meaning of | ((containsN & 2) << 2) . It seems to me that this part has no effect on the value of b.