1

I have a table with a list of credit card numbers and I would like to hash those numbers and add them to another column in the same table.

I am able to Hash the card numbers:

SELECT HASHBYTES('SHA1', PlainText)  
FROM CreditCard 

and I get a good list of hashed numbers but I can't seem to get those hashed numbers into another column. I tried to update the column with the hashed data using:

insert into Hash_TEMP(Hashcc)
  SELECT HASHBYTES('SHA1', PlainText) 
  from CreditCard

but the data doesn't look like hash numbers

What it looks like :

!¹^«±O&†Âûlà´Mq

what is should look like:

0x07CB9B44650188F693432A82687F5132681AF0F6

Any thoughts?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

0

Change the datatype of 'Hashcc' in Hash_temp table to binary and try your code.

Sachu
  • 7,555
  • 7
  • 55
  • 94