| 1 | //----------------------------------------------------------------------------- |
| 2 | // Merlok - June 2011 |
| 3 | // Roel - Dec 2009 |
| 4 | // Unknown author |
| 5 | // iceman - may 2015 |
| 6 | // marshmellow42 - june 2016 |
| 7 | // This code is licensed to you under the terms of the GNU GPL, version 2 or, |
| 8 | // at your option, any later version. See the LICENSE.txt file for the text of |
| 9 | // the license. |
| 10 | //----------------------------------------------------------------------------- |
| 11 | // MIFARE Darkside hack |
| 12 | //----------------------------------------------------------------------------- |
| 13 | |
| 14 | #ifndef __NONCE2KEY_H |
| 15 | #define __NONCE2KEY_H |
| 16 | |
| 17 | #include <stdio.h> |
| 18 | #include <stdlib.h> |
| 19 | #include "crapto1.h" |
| 20 | #include "common.h" |
| 21 | #include "mifare.h" // nonces_t struct |
| 22 | #include "ui.h" // PrintAndLog |
| 23 | #include "proxmark3.h" |
| 24 | #include "mifarehost.h" |
| 25 | |
| 26 | extern int nonce2key(uint32_t uid, uint32_t nt, uint32_t nr, uint64_t par_info, uint64_t ks_info, uint64_t * key); |
| 27 | extern int nonce2key_ex(uint8_t blockno, uint8_t keytype, uint32_t uid, uint32_t nt, uint32_t nr, uint64_t ks_info, uint64_t * key); |
| 28 | |
| 29 | //iceman, added these to be able to crack key direct from "hf 14 sim" && "hf mf sim" |
| 30 | bool tryMfk32(nonces_t data, uint64_t *outputkey ); |
| 31 | bool tryMfk32_moebius(nonces_t data, uint64_t *outputkey ); // <<-- this one has best success |
| 32 | int tryMfk64_ex(uint8_t *data, uint64_t *outputkey ); |
| 33 | int tryMfk64(uint32_t uid, uint32_t nt, uint32_t nr_enc, uint32_t ar_enc, uint32_t at_enc, uint64_t *outputkey); |
| 34 | #endif |