Search code examples
c#hexbase64arraysfingerprint

How to fix Issue with convert Base64 to byte from GPS & Fingerprint data compare?


I am trying to compare Finger print string & GPS data by converting byte array but result are not working for same finger record from different ends.

Here is my string/hex values from finger scan device & GPS accordingly. Finger print encoded result as below.

AwFZFo4A//7//vAA4ACAAIAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABSDRiePJYW3mEcxF5jKZueCSwPPiitjx4atw0+KT7LvimYFd9IIFe/diDbN1yihb91sAffQLoKnzsgbNw+JxT8OqmR/T+wThpGMkpWNSFU90mxyBcspZJSAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMBWRqRAP/+/wLgAMAAgACAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMZMXXlcZhF5SoAYeWKXbnh8qTx4RtA1eILsLfm8TWj8eFJWfPp0XX2sdWx9xI4cfa6wHvze2Cl8QQEyfdMBfvzCdbLpCQWMSQz6K8yGjEnY0pBT0MKZRlSQfa9I5rkySLB6V8yKg1FMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=

GPS Tracker sending in HEX Code as below

03 01 5A 16 96 00 FF FE E0 02 C0 00 80 00 80 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 0B 16 9E 59 91 03 FE 6D 15 1A BE 55 98 85 7E 5D 9E 5B 7E 3A A5 0E 1E 16 2C 8C BE 25 B2 8B 1E 1E 0D 95 5F 75 9A C6 B7 24 23 8E BF 70 A3 87 7F 3B AE 49 FF 16 B7 8B DF 36 91 00 1C 41 14 56 FC 3D 91 16 9A 37 9D 14 F8 33 1F 92 19 30 16 2C 56 24 1C 12 36 2C 17 55 35 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

How to compare both with byte array??
Finger print code required to Convert FromBase64 string to Byte and GPS code required to Hex to byte..
I am getting different array size from Finger print it returning 512 byte array and from GPS it comes 256 byte array..

below is my code form C# Create demo aspx page and check it.

I have added Demo project here. you can download and check it.. http://maplayout.com/demo.zip

Thanks
Abhi


Solution

  • I have been resolved issue by converting HEX Code string to Byte[] and USB reader value convert fromBase64 string then Byte[]

    I have created below method to Compare both with byte[],
    below fpengine is the thirdparty COM Object that will use for compare finger scanned value with finger point algorithm.

     public bool IsMatchFound(string HexCodeString , string USBReaderString)
            {
                try
                {
                    int scope = 0, intdisc=0;
                    byte[] gmat = HexEncoding.GetBytes(HexCodeString, out intdisc); //StringToByteArray(str1);
                    byte[] gref = Convert.FromBase64String(USBReaderString);
                    scope = fpengine.MatchTemplate(gmat, gref);
    
                    return (scope > 30) ? true : false;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
    

    Let me know if anybody want help same kind of application..