2011-05-31 19:31:20 +08:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Merlok - June 2011
|
|
|
|
// Roel - Dec 2009
|
|
|
|
// Unknown author
|
2016-04-18 19:08:18 +08:00
|
|
|
// iceman - may 2015
|
2016-08-05 03:57:18 +08:00
|
|
|
// marshmellow42 - june 2016
|
2011-05-31 19:31:20 +08:00
|
|
|
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
|
|
|
|
// at your option, any later version. See the LICENSE.txt file for the text of
|
|
|
|
// the license.
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// MIFARE Darkside hack
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2011-06-07 20:35:52 +08:00
|
|
|
#ifndef __NONCE2KEY_H
|
|
|
|
#define __NONCE2KEY_H
|
|
|
|
|
2011-05-31 19:31:20 +08:00
|
|
|
#include <stdio.h>
|
2012-11-08 17:48:02 +08:00
|
|
|
#include <stdlib.h>
|
2011-06-07 20:35:52 +08:00
|
|
|
#include "crapto1.h"
|
2012-09-18 21:52:50 +08:00
|
|
|
#include "common.h"
|
2016-08-10 05:11:07 +08:00
|
|
|
#include "mifare.h" // nonces_t struct
|
|
|
|
#include "ui.h" // PrintAndLog
|
2016-12-23 15:35:50 +08:00
|
|
|
#include "util.h" // FALSE / TRUE
|
2016-08-05 03:57:18 +08:00
|
|
|
#include "proxmark3.h"
|
|
|
|
#include "mifarehost.h"
|
2011-05-31 19:31:20 +08:00
|
|
|
|
2016-08-05 03:57:18 +08:00
|
|
|
extern int nonce2key(uint32_t uid, uint32_t nt, uint32_t nr, uint64_t par_info, uint64_t ks_info, uint64_t * key);
|
2016-08-10 05:11:07 +08:00
|
|
|
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);
|
2016-04-18 19:08:18 +08:00
|
|
|
|
|
|
|
//iceman, added these to be able to crack key direct from "hf 14 sim" && "hf mf sim"
|
2016-10-28 22:37:01 +08:00
|
|
|
bool tryMfk32(nonces_t data, uint64_t *outputkey, bool verbose );
|
|
|
|
bool tryMfk32_moebius(nonces_t data, uint64_t *outputkey, bool verbose); // <<-- this one has best success
|
2016-04-18 19:08:18 +08:00
|
|
|
int tryMfk64_ex(uint8_t *data, uint64_t *outputkey );
|
|
|
|
int tryMfk64(uint32_t uid, uint32_t nt, uint32_t nr_enc, uint32_t ar_enc, uint32_t at_enc, uint64_t *outputkey);
|
2011-06-07 20:35:52 +08:00
|
|
|
#endif
|