+
+ AuthData.ks2 = AuthData.ar_enc ^ ar;
+ AuthData.ks3 = AuthData.at_enc ^ at;
+
+ return true;
+}
+
+bool CheckCrypto1Parity(uint8_t *cmd, uint8_t cmdsize, uint8_t *cmd_enc, uint8_t *parity_enc) {
+ printf("parity check. size=%d\n", cmdsize);
+ printf("cmd =%s\n", sprint_hex(cmd, cmdsize));
+ printf("cmd_enc=%s\n", sprint_hex(cmd_enc, cmdsize));
+ printf("parity=%s\n", printBitsPar(parity_enc, cmdsize));
+// (oddparity8(ntx >> 8 & 0xff) ^ (ntx & 0x01) ^ ((ad->nt_enc_par >> 5) & 0x01) ^ (ad->nt_enc & 0x01)) ||
+ for (int i = 0; i < cmdsize - 1; i++) {
+ bool b = oddparity8(cmd[i]) ^ (cmd[i + 1] & 0x01) ^ ((parity_enc[i / 8] >> (6 - i % 8)) & 0x01) ^ (cmd_enc[i + 1] & 0x01);
+ printf("i=%d b=%d\n", i, b);
+ if (b)
+ return false;