Link to home
Start Free TrialLog in
Avatar of michtsoi
michtsoi

asked on

What is the encryption function of mssql

I am new to Mssql, I want to know how can I encrypt data according to different algorithm such as md5 and sha1.
In Mysql, I usually use sha1() or md5().
What are the similar functions in Mssql?
Thank you.

Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

If we are talking about SQL Server 2000, you are out of luck.

Also, the following questions are considered abandonded, please attend to them:
1 12/14/2005 500 PHP forum (Discus, vBulletin) Urgent  Open PHP
2 01/26/2006 500 Random number generation case study prob...  Open Microsoft SQL Server
3 01/27/2006 200 mssql problem about assigning consecutiv...  Open Microsoft SQL Server
4 02/21/2006 500 Cannot display nvarchar data from MSSQL ...  Open PHP
There are no such functions in sql server 2000, there are 2 functions, Pwdencrypt and pwdcompare. These are are internal, undocumented functions that SQL Server uses to manage passwords. Pwdencrypt uses a one-way hash that takes a clear string and returns an encrypted version of that string. Pwdcompare compares an unencrypted string to its encrypted representation to see whether they match. Microsoft cautions against using undocumented internal features, but sometimes people just can’t resist. With that said, yes, there is an undocumented, relatively unknown way to make strings encrypted with the SQL Server 6.5 version of pwdencrypt work with the SQL Server 7.0 version of pwdcompare. . . .

Avatar of michtsoi
michtsoi

ASKER

Then I am super unlucky that my company is still using Mssql 7.0.
As I know there is no user define function in Mssql 7.0, so am I need to implement a stored procedure to encrypt data by myself?

For those abandoned question, I cannot find an appropriate answer for my question.
 
1. I want to close it but I don't know how to do that.
2. No appropriate answer and I implement my own solution by myself. My reply is the last one.
3. Same as 2
4. I find the answer, although it is not a good one and even a bit werid, from another website and I share it to experts exchange. No   one can suggest to me a better answer.
   

 
Hi anneshattinqal,

My company is hosting 2 web sites, 1 of them uses Asp and Mssql and the other one uses php and mssql.
I want to united the data encryption of both site by using the same algorithm.

I have sha1 function in php, Mysql and javascript, but I don't have sha1 function in Mssql and Asp.

For example:
(Before encryption)                      (After encrtption)
Michael                         -->          f8c38b2167c0ab6d7c720e47c2139428d77d8b6a

If anyone can tell me how to achieve this result in Mssql and Asp, I will raise the point to 500 and assign to them.
Thank you very much.
>>I cannot find an appropriate answer for my question.<<
See here from the EE Help:

Nobody answered my question. What do I do?
https://www.experts-exchange.com/Databases/Microsoft_SQL_Server/help.jsp#hi71

I answered my question myself. What do I do?
https://www.experts-exchange.com/Databases/Microsoft_SQL_Server/help.jsp#hi70
The best you can do with SQL Server 7:
Undocumented Encrypt and Decrypt Functions in SQL Server 7.0
http://www.devx.com/tips/Tip/14407

As far as ASP is concerned you will have to either write or purchase a component.
ASKER CERTIFIED SOLUTION
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you acperkins.
The xpcrypt you introduced to me is so nice.