Skip to content

Commit 09a66e2

Browse files
authored
Merge pull request #668 from noproto/patch-1
Fix edge case -- 0.5% of UIDs got wrong result
2 parents fb17718 + 3dde112 commit 09a66e2

File tree

1 file changed

+2
-2
lines changed
  • applications/main/nfc/plugins/supported_cards

1 file changed

+2
-2
lines changed

applications/main/nfc/plugins/supported_cards/saflok.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ void generate_saflok_key(const uint8_t* uid, uint8_t* key) {
6262
uint8_t carry_sum = 0;
6363

6464
for(int i = KEY_LENGTH - 1; i >= 0; i--, magickal_index--) {
65-
uint16_t keysum = temp_key[i] + magic_table[magickal_index];
66-
temp_key[i] = (keysum & 0xFF) + carry_sum;
65+
uint16_t keysum = temp_key[i] + magic_table[magickal_index] + carry_sum;
66+
temp_key[i] = (keysum & 0xFF);
6767
carry_sum = keysum >> 8;
6868
}
6969

0 commit comments

Comments
 (0)