Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

A Comprehensive Guide to Writing NFC Tags Using Unique Keys

Posted on Jul 15 IntroductionNear Field Communication (NFC) technology has become increasingly popular due to its simplicity and versatility. NFC tags, small chips that use radio waves to communicate with nearby devices, can be used for a variety of applications, from contactless payments to smart home automation. One of the more advanced uses of NFC technology is writing unique keys to NFC tags, a process that requires a decent understanding of the NFC data structure. This article provides a detailed, step-by-step guide to writing NFC tags using unique keys.Understanding the NFC Data StructureThe first step in writing to an Nfc Tag is understanding the structure of the data stored on the tag. An NFC tag is divided into sectors, and each sector is further divided into blocks. The number of sectors and blocks varies depending on the type of NFC tag. For instance, the MIFARE Classic 1K tag, a common type of NFC tag, has 16 sectors, each containing 4 blocks. Each block can store 16 bytes of data.The data stored in these blocks can include anything from URLs to text strings to unique keys. In the context of this guide, the unique key is a specific piece of data retrieved from an NFC reader, such as the Flipper Zero. This key is stored in a specific block on the NFC tag.Locating the Correct BlockThe unique key retrieved from the reader is stored in a specific block. In the case of the Flipper Zero, it's stored in page 18 of the NFC file. This corresponds to a specific sector and block on the NFC tag. To find the correct block, you need to understand how the pages correlate to sectors and blocks.For example, if each sector contains 4 blocks, then page 18 would be in sector 4, block 2. This is calculated by dividing the page number by the number of blocks per sector (18 divided by 4 equals 4.5, rounded down to the nearest whole number for the sector), and finding the remainder when the page number is divided by the number of blocks per sector (18 modulo 4 equals 2 for the block).Editing the BlockOnce you've located the correct block, the next step is to edit the block with the new unique key. This requires a text editor capable of handling binary data, such as HxD for Windows or Hex Fiend for macOS. These editors display the data in the file as a series of hexadecimal numbers.Each block of data will be 16 bytes (or 32 hexadecimal digits) long. To replace the existing data with the new unique key, find the correct block based on the sector and block number calculated earlier. The unique key should be the same length as the existing data (16 bytes), and should be entered as a series of hexadecimal digits.For example, if the unique key is '1234567890ABCDEF', you would replace the existing data in the block with this key. Be careful to maintain the same length of data, as changing the length could corrupt the tag.Writing the NFC File to the TagThe final step is to write the modified NFC file to the NFC tag. This requires an NFC writing tool, which could be a dedicated device or an app on a smartphone with NFC capabilities. The writing tool will overwrite the existing data on the tag with the data from the NFC file.For example, if you're using an Android smartphone, you could use an app like NXP TagWriter. After loading the modified NFC file into the app, place the NFC tag near the smartphone. The app will then write the data from the file to the tag.ConclusionRemember, it's important to only write to NFC tags that you own and have permission to modify, and to always be careful when manipulating the data on an NFC tag to avoid corrupting the tag. This guide was to give you a better understanding of how NFC technology works, next week we dive deeper and execute emulating an NFC tag using the unique key recovered from the Flipper Zero. Follow me on twitter for more frequent updates, as well as hardware and software engineering tips! TWITTER: @RobotProxyWarTemplates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well Confirm For further actions, you may consider blocking this person and/or reporting abuse Omar.unwrap(); - Jun 13 '22 Philip Riecks - Jun 3 '22 Mehdi - May 25 '22 Richard Lenkovits - Mar 30 '22 Once suspended, kasirocswell will not be able to comment or publish posts until their suspension is removed. Once unsuspended, kasirocswell will be able to comment and publish posts again. Once unpublished, all posts by kasirocswell will become hidden and only accessible to themselves. If kasirocswell is not suspended, they can still re-publish their posts from their dashboard. Note: Once unpublished, this post will become invisible to the public and only accessible to War Machine. They can still re-publish the post if they are not suspended. Thanks for keeping DEV Community safe. Here is what you can do to flag kasirocswell: kasirocswell consistently posts content that violates DEV Community's code of conduct because it is harassing, offensive or spammy. Unflagging kasirocswell will restore default visibility to their posts. DEV Community — A constructive and inclusive social network for software developers. With you every step of your journey. Built on Forem — the open source software that powers DEV and other inclusive communities.Made with love and Ruby on Rails. DEV Community © 2016 - 2023. We're a place where coders share, stay up-to-date and grow their careers.



This post first appeared on VedVyas Articles, please read the originial post: here

Share the post

A Comprehensive Guide to Writing NFC Tags Using Unique Keys

×

Subscribe to Vedvyas Articles

Get updates delivered right to your inbox!

Thank you for your subscription

×