Mifare dump algorithm enhancement

hi, it may have already been addressed, but I had a question about the reading algorithm of the Mifare classic.

yesterday, I dumped a badge and the reading of the 16 sectors took almost 15mn.
it seems that the flipper tries each key of the dictionary on each block.
so if my key is at position 200/231 in the keychain, it will retry all 200 each time.

however, all the sectors on the badge had the same key, for A and B.
so by retrying the key of the previous sector on the next one, it would have taken about ~30 seconds.
what do you think ?

1 Like

When I start a read, I don’t know if it shows the actual testing key. But I do think it is worth to take a look, if there is a pattern between the matched keys.
That may is not helpful to guess the next one, but could help a faster analysis in more cases.

Most of the badges I’ve come across have the default keys from the manufacturer, and therefore the same on each sector.
So, I think it would be interesting to have a simple condition in the algorithm that tries the key of the previous sector on the next one (which would avoid the problem).

In this case, if the key is far in the mifare keys dictionary, once it is found there is no need to iterate from the beginning (unless the key does not work on the next sector).

1 Like

Implemented in PR #1822 and release 0.69.1 o/