Jump to content

A problem with varbinary type ???


nobitavn94

Recommended Posts

Hi all ,I have a table named MasterCard with a column named Code (this column is encrypted with SHA1 algorithm and has data type is varbinary - size 100 )I want to check if a credit card exist in MasterCard table as follow :........SHA1 sha =new SHA1CryptoServiceProvider();byte[] rawBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(cardId); //cardId :credit card codebyte[] hash = sha.ComputeHash(rawBytes);//hashStringBuilder sb = new StringBuilder(hash.Length * 2 + (hash.Length / 8));int i;for (i = 0; i < hash.Length; i++){ sb.Append( BitConverter.ToString( hash, i, 1) );}string encryptedCardId = sb.ToString().TrimEnd( new char[] { ' ' } );........But I cannot use this encryptedCardId to query data even though Code column is also encrypted by SHA1 algorithm .Thanks for any response !

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...