December 10, 2011 at 10:41 pm
Hi,
Currently, i am working on 2005 Encryption on our history data, which has many millions of rows with sensitive data. I am fine with Encryption. But, having problem with searches using FrontEnd application. I have decided to go with HashBytes for giving search on the sensitive data. When i test hash, it's generating different values. Which is correct or which method is better to choose ?
DECLARE @CRD CHAR(19)
SET @CRD = '1234567890123456'
SELECT CONVERT(BINARY(20), HashBytes('SHA1', @CRD))
SELECT CONVERT(BINARY(20), HashBytes('SHA1', '1234567890123456'))
Thanks,
Moorthy
December 11, 2011 at 3:57 am
Try the same code with VARCHAR datatype. It should work.
DECLARE @CRD VARCHAR(19) -- Replaced CHAR(19) with VARCHAR(19)
SET @CRD = '1234567890123456'
SELECT CONVERT(BINARY(20), HashBytes('SHA1', @CRD))
SELECT CONVERT(BINARY(20), HashBytes('SHA1', '1234567890123456'))
December 11, 2011 at 11:19 pm
Thanks Dev. I didn't think about it.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply