analyze nuid - now uses cliparser, and refactored to generators

This commit is contained in:
iceman1001 2021-01-09 11:43:49 +01:00
commit 3f4a98901d
3 changed files with 69 additions and 42 deletions

View file

@ -21,6 +21,7 @@
#include "pm3_cmd.h"
#include "ui.h"
#include "mbedtls/sha1.h"
#include "crc16.h" // crc16 ccitt
// Implemetation tips:
// For each implementation of the algos, I recommend adding a self test for easy "simple unit" tests when Travic CI / Appveyour runs.
@ -464,6 +465,22 @@ int mfdes_kdf_input_gallagher(uint8_t *uid, uint8_t uidLen, uint8_t keyNo, uint3
return PM3_SUCCESS;
}
int mfc_generate4b_nuid(uint8_t *uid, uint8_t *nuid) {
uint16_t crc;
uint8_t b1, b2;
compute_crc(CRC_14443_A, uid, 3, &b1, &b2);
nuid[0] = (b2 & 0xE0) | 0xF;
nuid[1] = b1;
crc = b1;
crc |= b2 << 8;
crc = crc16_fast(&uid[3], 4, reflect16(crc), true, true);
nuid[2] = (crc >> 8) & 0xFF ;
nuid[3] = crc & 0xFF;
return PM3_SUCCESS;
}
//------------------------------------
// Self tests
//------------------------------------

View file

@ -41,6 +41,8 @@ int mfc_algo_di_all(uint8_t *uid, uint8_t *keys);
int mfc_algo_sky_one(uint8_t *uid, uint8_t sector, uint8_t keytype, uint64_t *key);
int mfc_algo_sky_all(uint8_t *uid, uint8_t *keys);
int mfc_generate4b_nuid(uint8_t *uid, uint8_t *nuid);
uint32_t lf_t55xx_white_pwdgen(uint32_t id);
int mfdes_kdf_input_gallagher(uint8_t *uid, uint8_t uidLen, uint8_t keyNo, uint32_t aid, uint8_t *kdfInputOut, uint8_t *kdfInputLen);