-                       // crc_update(&desfire_crc32, 0, 1); /* CMD_WRITE */
-                       // crc_update(&desfire_crc32, addr, addr_sz);
-                       // crc_update(&desfire_crc32, byte, 8);
-                       // uint32_t crc = crc_finish(&desfire_crc32);
-                       
-
-       /* Version
-       
-       //uint8_t versionCmd1[] = {0x02, 0x60};
-       //uint8_t versionCmd2[] = {0x03, 0xaf};
-       //uint8_t versionCmd3[] = {0x02, 0xaf};
-
-    // AUTH 1  -  CMD: 0x02, 0x0A, 0x00  = Auth
-       // 0x02 = status byte för simpla svar?!? 
-       // 0x0a = krypto typ
-       // 0x00 = key nr
-       //uint8_t initAuthCmdDES[]  = {0x02, 0x0a, 0x00};  // DES
-       //uint8_t initAuthCmd3DES[] = {0x02, 0x1a, 0x00};  // 3DES
-       //uint8_t initAuthCmdAES[]  = {0x02, 0xaa, 0x00};  // AES
-       // auth 1 - answer command
-       // 0x03 = status byte för komplexa typer?
-       // 0xaf = additional frame
-       // LEN = 1+1+32+2 = 36
-       //uint8_t answerAuthCmd[34] = {0x03, 0xaf}; 
-
-       // Lägg till CRC
-       //AppendCrc14443a(versionCmd1,sizeof(versionCmd1));
-*/
-
-       // Sending commands
-       /*ReaderTransmit(versionCmd1,sizeof(versionCmd1)+2, NULL);
-       len = ReaderReceive(buffer);
-       print_result("Get Version 3", buffer, 9);
-       */
-       
-       // for( int i = 0; i < 8; i++){
-               // // Auth 1 - Request authentication
-               // ReaderTransmit(initAuthCmdAES,sizeof(initAuthCmdAES)+2, NULL);
-               // //len = ReaderReceive(buffer);
-
-               // // 0xAE =  authentication error
-               // if (buffer[1] == 0xae)       {
-                               // Dbprintf("Cmd Error: %02x", buffer[1]);
-                               // OnError();
-                               // return;
-               // }
-
-               // // tags enc nonce
-               // memcpy(encRndB, buffer+2, 16);
-
-               // // dekryptera svaret frÃ¥n tag.
-               // AesDecrypt(&ctx, encRndB, decRndB, 16);
-
-               // rol8(decRndB,16);
-               // memcpy(RndARndB, RndA,16);
-               // memcpy(RndARndB+16, decRndB ,16 );
-
-               // AesEncrypt(&ctx, RndARndB, encRndARndB, 32 );
-
-               // memcpy(answerAuthCmd+2, encRndARndB, 32);
-               // AppendCrc14443a(answerAuthCmd,sizeof(answerAuthCmd));
-       
-               // ReaderTransmit(answerAuthCmd,sizeof(answerAuthCmd)+2, NULL);
-
-               // len = ReaderReceive(buffer);
-
-               // print_result("Auth1a ", buffer, 8);
-               // Dbprintf("Rx len: %02x", len);
-
-               // if (buffer[1] == 0xCA)       {
-                               // Dbprintf("Cmd Error: %02x  Len: %d", buffer[1],len);
-                               // cmd_send(CMD_ACK,0,0,0,0,0);
-                               // key[1] = i;
-                               // AesCtxIni(&ctx, iv, key, KEY128, CBC);
-               // }
-       // }
-
-       //des_dec(decRndB, encRndB, key);
-       
-    //Do crypto magic
-       /*
-    DES_ede2_cbc_encrypt(e_RndB,RndB,sizeof(e_RndB),&ks1,&ks2,&iv,0);
-    memcpy(RndARndB,RndA,8);
-    memcpy(RndARndB+8,RndB,8);
-    PrintAndLog("     RA+B:%s",sprint_hex(RndARndB, 16));
-    DES_ede2_cbc_encrypt(RndARndB,RndARndB,sizeof(RndARndB),&ks1,&ks2,&e_RndB,1);
-    PrintAndLog("enc(RA+B):%s",sprint_hex(RndARndB, 16));
-    */
-
-
-int mifare_des_auth2(uint32_t uid, uint8_t *key, uint8_t *blockData){
-       
-       uint8_t* buffer = mifare_get_bigbufptr();
-       uint8_t dcmd[19];
-    
-       dcmd[0] = 0xAF;
-    memcpy(dcmd+1,key,16);
-       AppendCrc14443a(dcmd, 17);
-       
-
-       ReaderTransmit(dcmd, sizeof(dcmd), NULL);
-       int len = ReaderReceive(buffer);
-       if(!len) {
-          if (MF_DBGLEVEL >= 1)   Dbprintf("Authentication failed. Card timeout.");
-          len = ReaderReceive(buffer);
-    }
-    
-       if(len==1)      {
-        if (MF_DBGLEVEL >= 1) {
-                       Dbprintf("NAK - Authentication failed.");
-                       Dbprintf("Cmd Error: %02x", buffer[0]);
-               }
-               return 1;
-       }
-
-       if (len == 11){
-               if (MF_DBGLEVEL >= 1) {
-                       Dbprintf("Auth2 Resp: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",
-                                         buffer[0],buffer[1],buffer[2],buffer[3],buffer[4],
-                                         buffer[5],buffer[6],buffer[7],buffer[8],buffer[9],
-                                         buffer[10]);
-               }
-               return 0;
-       }
-       return 1;
-}
-
-void MifareDES_Auth2(uint32_t arg0, uint8_t *datain){
-
-       return;
-       uint32_t cuid = arg0;
-       uint8_t key[16];
-
-       byte_t isOK = 0;
-       byte_t dataoutbuf[16];
-       
-    memset(key, 0, 16);
-       memcpy(key, datain, 16);
-    
-       LED_A_ON();
-       LED_B_OFF();
-       LED_C_OFF();
-
-       if(mifare_des_auth2(cuid, key, dataoutbuf)){
-           if (MF_DBGLEVEL >= 1) Dbprintf("Authentication part2: Fail...");    
-       }
-       isOK=1;
-       if (MF_DBGLEVEL >= 2)   DbpString("AUTH 2 FINISHED");
-    
-       LED_B_ON();
-    cmd_send(CMD_ACK,isOK,0,0,dataoutbuf,11);
-       LED_B_OFF();
-    
-    // Thats it...
-       FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
-       LEDsoff();
-}