I have a DB with SSN. I would like to encrypt using HashBytes with salt.
I ran
UPDATE tablex
SET essn=HashBytes('SHA1',ssn+salt)
it runs correctly but when I query for WHERE
essn=HashBytes('SHA1','111-11-2222salt') it does not find the record
ssn is a nvchar column salt is also nvchar column
Please help. Thx> ssn is a nvchar column salt is also nvchar column
In that case, specify a Unicode string:
WHERE ssn=HashBytes('SHA1', N'111-11-2222salt')
Hope this helps.
Dan Guzman
SQL Server MVP
"LucFastLife" <LucFastLife@.discussions.microsoft.com> wrote in message
news:E47C332C-5420-4E22-978B-FF01BE55903D@.microsoft.com...
>I have a DB with SSN. I would like to encrypt using HashBytes with salt.
> I ran
> UPDATE tablex
> SET essn=HashBytes('SHA1',ssn+salt)
> it runs correctly but when I query for WHERE
> essn=HashBytes('SHA1','111-11-2222salt') it does not find the record
> ssn is a nvchar column salt is also nvchar column
> Please help. Thx
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment