We help IT Professionals succeed at work.

What is the encryption function of mssql

michtsoi
michtsoi asked
on
Medium Priority
653 Views
Last Modified: 2008-02-01
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.

Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2012

Commented:
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
AneeshDatabase Consultant
CERTIFIED EXPERT
Top Expert 2009

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

Author

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.
   

 

Author

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.
CERTIFIED EXPERT
Top Expert 2012

Commented:
>>I cannot find an appropriate answer for my question.<<
See here from the EE Help:

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

I answered my question myself. What do I do?
http://www.experts-exchange.com/Databases/Microsoft_SQL_Server/help.jsp#hi70
CERTIFIED EXPERT
Top Expert 2012

Commented:
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.
CERTIFIED EXPERT
Top Expert 2012
Commented:
Here are some free components:
http://www.activecrypt.com/products.html

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
Thank you acperkins.
The xpcrypt you introduced to me is so nice.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.