Skip to content

Commit

Permalink
Merge pull request #668 from noproto/patch-1
Browse files Browse the repository at this point in the history
Fix edge case -- 0.5% of UIDs got wrong result
  • Loading branch information
xMasterX authored Dec 13, 2023
2 parents fb17718 + 3dde112 commit 09a66e2
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 09a66e2

Please sign in to comment.