Re: HashBytes

From: Dan Guzman (guzmanda_at_nospam-online.sbcglobal.net)
Date: 10/08/05

  • Next message: Uri Dimant: "Re: Hlep with Simple questions about Authentication"
    Date: Fri, 7 Oct 2005 20:10:43 -0500
    
    

    > 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 
    

  • Next message: Uri Dimant: "Re: Hlep with Simple questions about Authentication"