CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2008
    Posts
    111

    Question Decoding RFID data hexadecimal math issue C++

    I currently am stuck at getting the needed outcome data from my RFID card. I got it decoded but now I need to do a few more things in order to get the final card number off the back of the card.

    The cryptic value was E********B**0**E** (covered to protect card)
    Decrypting it turned into 0000003048D1263B

    Now I have 3 more steps to take in order to get to my wanted card number.

    Step 1) Mask off the lower 20-bits (which should give me 0x1263B) I am unsure of how to go about doing that using C++.
    Step 2) Divide by 2 to strip off the lower parity bit (which should be 0x931d). And again, I'm unsure of how to go about doing this in C++.
    Step 3) Convert hexadecimal value to decimal value (which would equal my wanted card number). This should be easily done using C++ at this point - though hard to confirm that since I am on step 1).
    Code:
        const char* original = "0x931d";
    	unsigned long n = std::strtoul(original, nullptr, 16);
    All of this looks to me like RegEX does to most people - complicated and not understanding why it does what it does but gives the correct output.

    All help would be appreciated!

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Decoding RFID data hexadecimal math issue C++

    Quote Originally Posted by StealthRT View Post
    Now I have 3 more steps to take in order to get to my wanted card number.
    Step 1) Mask off the lower 20-bits (which should give me 0x1263B) I am unsure of how to go about doing that using C++.
    C Bitwise Operators
    Victor Nijegorodov

  3. #3
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,824

    Re: Decoding RFID data hexadecimal math issue C++

    This question has already been asked and answered here http://www.vbforums.com/showthread.p...l-math-issue-C
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured