• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 638
  • Last Modified:

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.

  • 4
  • 3
1 Solution
Anthony PerkinsCommented:
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
Aneesh RetnakaranDatabase AdministratorCommented:
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. . . .

michtsoiAuthor Commented:
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.

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

michtsoiAuthor Commented:
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.
Anthony PerkinsCommented:
>>I cannot find an appropriate answer for my question.<<
See here from the EE Help:

Nobody answered my question. What do I do?

I answered my question myself. What do I do?
Anthony PerkinsCommented:
The best you can do with SQL Server 7:
Undocumented Encrypt and Decrypt Functions in SQL Server 7.0

As far as ASP is concerned you will have to either write or purchase a component.
Anthony PerkinsCommented:
Here are some free components:
michtsoiAuthor Commented:
Thank you acperkins.
The xpcrypt you introduced to me is so nice.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now