I have two readers:
They send different codes from tags (wiegand - USB):
13711284 - 6ECBD718
14056036 - CEA4D818
13409492 - 9E5BD718
How to convert?
There is two operations: NOT and reverse bits :)
public static Int32 CARD_CODE_LENGTH = 5;
static void Main(string[] args)
{
if (args.Length == 0) return;
String value = args[0];
if (value.Length < CARD_CODE_LENGTH)
throw new ArgumentException();
String cardCode = value.Substring(value.Length - CARD_CODE_LENGTH, CARD_CODE_LENGTH);
String facilityCode = value.Substring(0, value.Length - cardCode.Length);
Byte facility = ReverseWithLookupTable((Byte)(~Byte.Parse(facilityCode)));
UInt16 card = (UInt16)(~UInt16.Parse(cardCode));
Byte[] result = new Byte[2];
var temp = BitConverter.GetBytes(card);
for (var i = 0; i < temp.Length; result[i] = ReverseWithLookupTable(temp[i++]));
Console.WriteLine("{0}{1}{2}", facility.ToString("X2"), result[1].ToString("X2"), result[0].ToString("X2"));
Console.Read();
}