Skip to content

Commit

Permalink
Fix edge case -- 0.5% of UIDs got wrong result
Browse files Browse the repository at this point in the history
  • Loading branch information
noproto authored Dec 12, 2023
1 parent 0b356c2 commit 3dde112
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions applications/main/nfc/plugins/supported_cards/saflok.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ void generate_saflok_key(const uint8_t* uid, uint8_t* key) {
uint8_t carry_sum = 0;

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

Expand Down

0 comments on commit 3dde112

Please sign in to comment.