mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-26 22:40:25 +00:00
Merge pull request #668 from noproto/patch-1
Fix edge case -- 0.5% of UIDs got wrong result
This commit is contained in:
commit
09a66e2285
1 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue