1 #include "hash1_brute.h"
3 #include "cipherutils.h"
9 #include "elite_crack.h"
12 static void calc_score(uint8_t *csn
, uint8_t *k
) {
15 uint8_t goodvals
[16] = {0};
16 uint8_t uniq_vals
[8] = {0};
17 memset(goodvals
, 0x00, 16);
18 memset(uniq_vals
, 0x00, 8);
21 for (i
= 0; i
< 8 ; i
++) {
22 if (k
[i
] == 0x01) continue;
23 if (k
[i
] == 0x00) continue;
24 if (k
[i
] == 0x45) continue;
28 // if(k[i] ==9 || k[i]==2){
29 // goodvals[k[i]] = 1;
32 // else if (k[i] >= 16) {
38 for (i
= 0; i
< 16; i
++) {
45 if (score
>= 2 && badscore
< 2) {
46 PrintAndLogEx(NORMAL
, "CSN\t%02x%02x%02x%02x%02x%02x%02x%02x\t%02x %02x %02x %02x %02x %02x %02x %02x\t" NOLF
47 , csn
[0], csn
[1], csn
[2], csn
[3], csn
[4], csn
[5], csn
[6], csn
[7]
48 , k
[0], k
[1], k
[2], k
[3], k
[4], k
[5], k
[6], k
[7]
51 for (i
= 0 ; i
< score
; i
++) {
52 PrintAndLogEx(NORMAL
, "%d," NOLF
, uniq_vals
[i
]);
54 PrintAndLogEx(NORMAL
, "\tbadscore: %d (%02x)" NOLF
, badscore
, badval
);
55 PrintAndLogEx(NORMAL
, "");
59 void brute_hash1(void) {
61 uint8_t csn
[8] = {0, 0, 0, 0, 0xf7, 0xff, 0x12, 0xe0};
62 uint8_t k
[8] = {0, 0, 0, 0, 0, 0, 0, 0};
63 uint8_t testcsn
[8] = {0x00, 0x0d, 0x0f, 0xfd, 0xf7, 0xff, 0x12, 0xe0} ;
64 uint8_t testkey
[8] = {0x05, 0x01, 0x00, 0x10, 0x45, 0x08, 0x45, 0x56} ;
65 calc_score(testcsn
, testkey
);
67 PrintAndLogEx(INFO
, "Brute forcing hashones");
69 for (uint16_t a
= 0; a
< 256; a
++) {
70 for (uint16_t b
= 0; b
< 256; b
++) {
71 for (uint16_t c
= 0; c
< 256; c
++) {
72 for (uint16_t d
= 0; d
< 256; d
++) {