@@ -11,7 +11,7 @@
|
|||||||
*
|
*
|
||||||
* Of course with non-bricked devices, you're free to select them before calling this function.
|
* Of course with non-bricked devices, you're free to select them before calling this function.
|
||||||
*/
|
*/
|
||||||
bool MFRC522Hack::MIFARE_OpenUidBackdoor(const bool logErrors) const {
|
bool MFRC522Hack::MIFARE_OpenUidBackdoor(bool logErrors) {
|
||||||
// Magic sequence:
|
// Magic sequence:
|
||||||
// > 50 00 57 CD (HALT + CRC)
|
// > 50 00 57 CD (HALT + CRC)
|
||||||
// > 40 (7 bits only)
|
// > 40 (7 bits only)
|
||||||
@@ -83,7 +83,7 @@ bool MFRC522Hack::MIFARE_OpenUidBackdoor(const bool logErrors) const {
|
|||||||
* It assumes a default KEY A of 0xFFFFFFFFFFFF.
|
* It assumes a default KEY A of 0xFFFFFFFFFFFF.
|
||||||
* Make sure to have selected the card before this function is called.
|
* Make sure to have selected the card before this function is called.
|
||||||
*/
|
*/
|
||||||
bool MFRC522Hack::MIFARE_SetUid(const byte *newUid, const byte uidSize, const bool logErrors) const {
|
bool MFRC522Hack::MIFARE_SetUid(byte *newUid, byte uidSize, bool logErrors) {
|
||||||
|
|
||||||
// UID + BCC byte can not be larger than 16 together
|
// UID + BCC byte can not be larger than 16 together
|
||||||
if (!newUid || !uidSize || uidSize > 15) {
|
if (!newUid || !uidSize || uidSize > 15) {
|
||||||
@@ -184,7 +184,7 @@ bool MFRC522Hack::MIFARE_SetUid(const byte *newUid, const byte uidSize, const bo
|
|||||||
/**
|
/**
|
||||||
* Resets entire sector 0 to zeroes, so the card can be read again by readers.
|
* Resets entire sector 0 to zeroes, so the card can be read again by readers.
|
||||||
*/
|
*/
|
||||||
bool MFRC522Hack::MIFARE_UnbrickUidSector(const bool logErrors) const {
|
bool MFRC522Hack::MIFARE_UnbrickUidSector(bool logErrors) {
|
||||||
MIFARE_OpenUidBackdoor(logErrors);
|
MIFARE_OpenUidBackdoor(logErrors);
|
||||||
|
|
||||||
byte block0_buffer[] = {0x01, 0x02, 0x03, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
byte block0_buffer[] = {0x01, 0x02, 0x03, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
|||||||
@@ -9,13 +9,13 @@ class MFRC522Hack {
|
|||||||
private:
|
private:
|
||||||
MFRC522 *const _device;
|
MFRC522 *const _device;
|
||||||
public:
|
public:
|
||||||
MFRC522Hack(MFRC522 *const device) : _device(device) {};
|
MFRC522Hack(MFRC522 *device) : _device(device) {};
|
||||||
|
|
||||||
bool MIFARE_OpenUidBackdoor(const bool logErrors) const;
|
bool MIFARE_OpenUidBackdoor(bool logErrors);
|
||||||
|
|
||||||
bool MIFARE_SetUid(const byte *newUid, const byte uidSize, const bool logErrors) const;
|
bool MIFARE_SetUid(byte *newUid, byte uidSize, bool logErrors);
|
||||||
|
|
||||||
bool MIFARE_UnbrickUidSector(const bool logErrors) const;
|
bool MIFARE_UnbrickUidSector(bool logErrors);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user