Release v4.15864 - Radium
[RRG-proxmark3.git] / armsrc / hitag2crack.h
blob9a123ec303baa7a4c84ac134f26bcfb2c47e9a25
1 //-----------------------------------------------------------------------------
2 // Borrowed initially from https://github.com/factoritbv/hitag2hell
3 // and https://github.com/AdamLaurie/RFIDler/blob/master/firmware/Pic32/RFIDler.X/src/hitag2crack.c
4 // Copyright (C) Kevin Sheldrake <kev@headhacking.com>, Aug 2018
5 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
6 //
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // See LICENSE.txt for the text of the license.
18 //-----------------------------------------------------------------------------
19 // Definitions hitag2 attack functions
20 //-----------------------------------------------------------------------------
22 bool hitag2_crack(uint8_t *response, uint8_t *nrarhex);
23 bool hitag2crack_find_valid_e_cmd(uint8_t e_cmd[], uint8_t nrar[]);
24 bool hitag2crack_find_e_page0_cmd(uint8_t keybits[], uint8_t e_firstcmd[], uint8_t nrar[], uint8_t uid[]);
25 bool hitag2crack_test_e_p0cmd(uint8_t *keybits, uint8_t *nrar, uint8_t *e_cmd, uint8_t *uid, uint8_t *e_uid);
26 void hitag2crack_xor(uint8_t *target, const uint8_t *source, const uint8_t *pad, unsigned int len);
27 bool hitag2crack_read_page(uint8_t *responsestr, uint8_t pagenum, uint8_t *nrar, uint8_t *keybits);
28 bool hitag2crack_send_e_cmd(uint8_t *responsestr, uint8_t *nrar, uint8_t *cmd, int len);
29 bool hitag2crack_tx_rx(uint8_t *responsestr, uint8_t *msg, int len, int state, bool reset);
31 bool hitag2crack_rng_init(uint8_t *response, uint8_t *input);
32 bool hitag2crack_decrypt_hex(uint8_t *response, uint8_t *hex);
33 bool hitag2crack_decrypt_bin(uint8_t *response, uint8_t *e_binstr);
34 bool hitag2crack_encrypt_hex(uint8_t *response, uint8_t *hex);
35 bool hitag2crack_encrypt_bin(uint8_t *response, uint8_t *e_binstr);
37 bool hitag2_keystream(uint8_t *response, uint8_t *nrarhex);
38 bool hitag2crack_send_auth(uint8_t *nrar);
39 bool hitag2crack_consume_keystream(uint8_t *keybits, int kslen, int *ksoffset, uint8_t *nrar);
40 bool hitag2crack_extend_keystream(uint8_t *keybits, int *kslen, int ksoffset, uint8_t *nrar, uint8_t *uid);
42 bool hitag2_reader(uint8_t *response, uint8_t *key, bool interactive);