- //PrintAndLog("CC: %s",sprint_hex(CCNR,8));
- diversifyKey(CSN,KEY, div_key);
+ if(elite)
+ {
+ uint8_t key_sel[8] = {0};
+ uint8_t key_sel_p[8] = { 0 };
+ //Get the key index (hash1)
+ uint8_t key_index[8] = {0};
+
+ hash1(CSN, key_index);
+ printvar("hash1", key_index,8);
+ for(i = 0; i < 8 ; i++)
+ key_sel[i] = keytable[key_index[i]] & 0xFF;
+ printvar("k_sel", key_sel,8);
+ //Permute from iclass format to standard format
+ permutekey_rev(key_sel,key_sel_p);
+ used_key = key_sel_p;
+ }else{
+ used_key = KEY;
+
+ }
+ printvar("CC:",CCNR,8);
+ printvar("Used key",used_key,8);
+ diversifyKey(CSN,used_key, div_key);
+ printvar("Div key", div_key, 8);