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.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.

Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

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:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
michtsoiAuthor Commented:
Thank you acperkins.
The xpcrypt you introduced to me is so nice.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.