0

I have a problem with reading code from RFID card.

Any conversion algorithm exist?

Examples of codes:
04006d0ba0 -> 00008596950352
0d001c59b3 -> 00047253268956
0d001c5134 -> 00047253268674
0d001c9317 -> 00047253265550
0d001c93ed -> 00047253265531
0d001c1b12 -> 00047253261700
0d001c1b1d -> 00047253261707
e800ef0aac -> 00485339628883

Same RFID card, different outputs from different readers...

I know that topic like that exist yet, but i think that is not same problem...

Michael Roland
  • 39,663
  • 10
  • 99
  • 206
Milan Antoš
  • 11
  • 1
  • 1

1 Answers1

2

The conversion looks quite simple:

  • Let's assume that you want to convert "04006d0ba0" to "00008596950352".

  • Take each nibble from the hexadecimal number "04006d0ba0" (i.e. "0", then "4", then "0", then "0", then "6", ...)

  • Reverse the bits of each nibble (least significant bit becomes most significant bit, second bit becomes second last bit), e.g. "0" (= 0000) remains "0" (= 0000), "4" (= 0100) becomes "2" (= 0010), "6" (= 0110) remains "6" (= 0110), etc.

  • Convert into decimal number format.

In Java, this could look something like this:

private static final byte[] REVERSE_NIBBLE = {
        0x00, 0x08, 0x04, 0x0C, 0x02, 0x0A, 0x06, 0x0E,
        0x01, 0x09, 0x05, 0x0D, 0x03, 0x0B, 0x07, 0x0F
};

private long convert(byte[] input) {
    byte[] output = new byte[input.length];

    for (int i = 0; i < input.length; ++i) {
        output[i] = (byte)((REVERSE_NIBBLE[(output[i] >>> 4) & 0x0F] << 4) |
                            REVERSE_NIBBLE[ output[i]        & 0x0F]);
    }

    return new BigInteger(1, output).longValue();
}
Michael Roland
  • 39,663
  • 10
  • 99
  • 206