Encrypting Data With the Encrypt Function

  • I'm trying to select from a column that has been Encrypted. This will not work or at least does not show me what the true value is :

    SELECT Fname, Lname, ENCRYPT(Password) AS Password

    FROM dbo.Employees

    I have an application that send the password to users that forgotten it. Its written ASP but I’m simply writing the SQL on the asp page. Any help would help. Thanks

  • If I remember right, ENCRYPT() is a one-way function. You can't use it to decrypt the ciphertext (encrypted) string. Also, you probably want to avoid using this function if you have the option because it is an undocumented function, meaning there's no guarantee it'll persist between versions of SQL Server.

    K. Brian Kelley

    http://www.truthsolutions.com/

    Author: Start to Finish Guide to SQL Server Performance Monitoring

    http://www.netimpress.com/shop/product.asp?ProductID=NI-SQL1

    K. Brian Kelley
    @kbriankelley

  • Look at the result of the ENCRYPT function. All it does is write the output in pseudo-double byte hex format of the original string. You could look into using pwdencrypt and pwdcompare functions - but they are undocumented. We prefer to use our own encryption routines external to SQL.

    Guarddata-

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply