Topic: Fast Legic Read Code, including prng

As there are several people spending way too much time actually implementing a writer (it took myself one week of full-time commitment), I’ll speed this up a little bit and post some code that implements the prng-cipher and then allows to read legic cards much quicker. It also checks if the CRC matches.
I’m kind of still worried on having everyone being able to write, so there is no actual code for writing, but it’s now trivial to implement and some instructions are provided in the source.

As I didn’t have a MIM1024 card this code is only for MIM256, but nevertheless it’s easy to adopt to the bigger cards (although the crc-iv might change then).
On last hint: the slides mention an ACK being sent 3.6ms after the write command. The time interval is actually different between cards, so a writer should not rely on timing but wait until the ACK is actually received.

You can find the patch here: http://itooktheredpill.dyndns.org/publi … eader.diff

Re: Fast Legic Read Code, including prng

Nice - I've merged this in as r325...

Re: Fast Legic Read Code, including prng

http://codeviewer.org/view/code:bca

Fixes MIM1024 support

Re: Fast Legic Read Code, including prng

Cool smile Have you actually tried reading a MIM1024 card using that method, because if I chose the wrong IV / xorMask for the CRC, then this might yield lots of errors.
Also addr_size is rather cmd_size, might be misleading to new code-readers.

Re: Fast Legic Read Code, including prng

Yes MIM1024 is working fine. I also did doublecheck MIM256.

I added an abort statement after the CRC-Error as the key generator is out of sync anyway.
(the usb transfer takes 50ms)

this way removing card during read is detected and trying to read with no legic present does not produce 256 errors

Re: Fast Legic Read Code, including prng

rumpeltux wrote:

also addr_size is rather cmd_size, might be misleading to new code-readers.

you are right

2nd try :-): http://codeviewer.org/view/code:bcc

Re: Fast Legic Read Code, including prng

Excellent! Now in as rev 332/333...