The answer is that the second reader is returning ASCII encoded decimals. Your number is 1059548974
. This number, encoded into hexadecimals is 3F276F2E
if you use Big Endian encoding. If you use Little Endian encoding then you will get 2E6F273F
which should be familiar to you.
So:
- decode the returned byte array to ASCII, retrieving the string
"1059548974"
- convert that string to an integer using
Convert.ToUInt32(str);
- reverse the bytes in the integer
Probably the best way to reverse the bytes is this piece of code:
public static UInt32 ReverseBytes(UInt32 value)
{
return (value & 0x000000FFU) << 24 | (value & 0x0000FF00U) << 8 |
(value & 0x00FF0000U) >> 8 | (value & 0xFF000000U) >> 24;
}