add white cloner pwdgen algo (thanks to @paleopterix!)

This commit is contained in:
iceman1001 2020-09-19 11:08:01 +02:00
commit 1aa9600048
4 changed files with 35 additions and 1 deletions

View file

@ -414,12 +414,21 @@ int mfc_algo_sky_all(uint8_t *uid, uint8_t *keys) {
return PM3_SUCCESS;
}
// LF T55x7 White gun cloner algo
uint32_t lf_t55xx_white_pwdgen(uint32_t id) {
uint32_t r1 = rotl(id & 0x000000ec, 8);
uint32_t r2 = rotl(id & 0x86000000, 16);
uint32_t pwd = 0x10303;
pwd += ((id & 0x86ee00ec) ^ r1 ^ r2 );
return pwd;
}
//------------------------------------
// Self tests
//------------------------------------
int generator_selftest(void) {
#define NUM_OF_TEST 5
#define NUM_OF_TEST 6
PrintAndLogEx(INFO, "PWD / KEY generator selftest");
PrintAndLogEx(INFO, "----------------------------");
@ -468,6 +477,13 @@ int generator_selftest(void) {
testresult++;
PrintAndLogEx(success ? SUCCESS : WARNING, "UID | %s | %"PRIx64" - %s", sprint_hex(uid6, 4), key6, success ? "OK" : "->82C7E64BC565<--");
uint32_t lf_id = lf_t55xx_white_pwdgen(0x00000080);
success = (lf_id = 0x00018383);
if (success)
testresult++;
PrintAndLogEx(success ? SUCCESS : WARNING, "ID | 0x00000080 | %08"PRIx32 " - %s", lf_id, success ? "OK" : "->00018383<--");
PrintAndLogEx(SUCCESS, "------------------- Selftest %s", (testresult == NUM_OF_TEST) ? "OK" : "fail");
return PM3_SUCCESS;
}