optimized_elite.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //-----------------------------------------------------------------------------
  2. // Borrowed initially from https://github.com/holiman/loclass
  3. // More recently from https://github.com/RfidResearchGroup/proxmark3
  4. // Copyright (C) 2014 Martin Holst Swende
  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.
  11. //
  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.
  16. //
  17. // See LICENSE.txt for the text of the license.
  18. //-----------------------------------------------------------------------------
  19. // WARNING
  20. //
  21. // THIS CODE IS CREATED FOR EXPERIMENTATION AND EDUCATIONAL USE ONLY.
  22. //
  23. // USAGE OF THIS CODE IN OTHER WAYS MAY INFRINGE UPON THE INTELLECTUAL
  24. // PROPERTY OF OTHER PARTIES, SUCH AS INSIDE SECURE AND HID GLOBAL,
  25. // AND MAY EXPOSE YOU TO AN INFRINGEMENT ACTION FROM THOSE PARTIES.
  26. //
  27. // THIS CODE SHOULD NEVER BE USED TO INFRINGE PATENTS OR INTELLECTUAL PROPERTY RIGHTS.
  28. //-----------------------------------------------------------------------------
  29. // It is a reconstruction of the cipher engine used in iClass, and RFID techology.
  30. //
  31. // The implementation is based on the work performed by
  32. // Flavio D. Garcia, Gerhard de Koning Gans, Roel Verdult and
  33. // Milosch Meriac in the paper "Dismantling IClass".
  34. //-----------------------------------------------------------------------------
  35. #ifndef ELITE_CRACK_H
  36. #define ELITE_CRACK_H
  37. #include <stdint.h>
  38. #include <stdlib.h>
  39. void loclass_permutekey(const uint8_t key[8], uint8_t dest[8]);
  40. /**
  41. * Permutes a key from iclass specific format to NIST format
  42. * @brief loclass_permutekey_rev
  43. * @param key
  44. * @param dest
  45. */
  46. void loclass_permutekey_rev(const uint8_t key[8], uint8_t dest[8]);
  47. /**
  48. * Hash1 takes CSN as input, and determines what bytes in the keytable will be used
  49. * when constructing the K_sel.
  50. * @param csn the CSN used
  51. * @param k output
  52. */
  53. void loclass_hash1(const uint8_t* csn, uint8_t* k);
  54. void loclass_hash2(const uint8_t* key64, uint8_t* outp_keytable);
  55. #endif