Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
I have tested it using window application of C#, In this we have two Hexadecimal value, And we check that the source value exists in our database or not.
//8 Byte Hexadecimal Value of source this.txtSource.Text = "0x00004000";
//8 Byte Hexadecimal Value of DB this.txtDB.Text = "0xAF00D0b0"; } private void button1_Click(object sender, EventArgs e) { //Convert the Hexadecimal value inot uint. uint i = GetHexValue(txtDB.Text.ToString()); uint b = GetHexValue(txtSource.Text.ToString()); txtResult.Text = (i & b) > 0 ? "Match" : "UnMatch"; }
//This is the function used for returning uint value from hexadecimal value. public uint GetHexValue(String text) { uint result = 0; String parseText = text; if (parseText.StartsWith("0x", true, CultureInfo.InvariantCulture)) { parseText = text.Substring(2); } if (UInt32.TryParse(parseText, NumberStyles.AllowHexSpecifier, CultureInfo.InvariantCulture, out result) == false) { throw new ArgumentException("Text value must be a valid hexidecimal number" + text); } return result; }