.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani

Home >> Forum >> Sql Server >> Post New QuestionBookmark and Share Subscribe to Forum

password encryption in SQL server

Posted By: Kemal AL GAZZAH     Posted Date: June 27, 2011    Points:5   Category :Sql Server
I am looking for a complte source code which helps in encrypting/decrypting a password column in sql server 2000
Any help is appreciated

Responses
Author: Gowthammanju             
Posted Date: June 28, 2011     Points: 20   

Hey

plz find attachment below


this may help u

Download Attachment

Thanks & Regards,
GowthamManju
Chennai



Mark if the answer is true
Author: Palani Kumar A             
Posted Date: June 28, 2011     Points: 20   

hi,

Refer below Link and below function useful to you;

CREATE FUNCTION dbo.fnEncDecRc4
(
@Pwd VARCHAR(256),
@Text VARCHAR(8000)
)
RETURNS VARCHAR(8000)
AS

BEGIN
DECLARE @Box TABLE (i TINYINT, v TINYINT)

INSERT @Box
(
i,
v
)
SELECT i,
v
FROM dbo.fnInitRc4(@Pwd)

DECLARE @Index SMALLINT,
@i SMALLINT,
@j SMALLINT,
@t TINYINT,
@k SMALLINT,
@CipherBy TINYINT,
@Cipher VARCHAR(8000)

SELECT @Index = 1,
@i = 0,
@j = 0,
@Cipher = ''

WHILE @Index <= DATALENGTH(@Text)
BEGIN
SELECT @i = (@i + 1) % 256

SELECT @j = (@j + b.v) % 256
FROM @Box b
WHERE b.i = @i

SELECT @t = v
FROM @Box
WHERE i = @i

UPDATE b
SET b.v = (SELECT w.v FROM @Box w WHERE w.i = @j)
FROM @Box b
WHERE b.i = @i

UPDATE @Box
SET v = @t
WHERE i = @j

SELECT @k = v
FROM @Box
WHERE i = @i

SELECT @k = (@k + v) % 256
FROM @Box
WHERE i = @j

SELECT @k = v
FROM @Box
WHERE i = @k

SELECT @CipherBy = ASCII(SUBSTRING(@Text, @Index, 1)) ^ @k,
@Cipher = @Cipher + CHAR(@CipherBy)

SELECT @Index = @Index +1
END

RETURN @Cipher
END


refer below LinK:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=76258

With Regards
Palani Kumar A
Author: Sasi Prabhu             
Posted Date: June 28, 2011     Points: 20   
Author: Ravi Ranjan Kumar             
Posted Date: June 28, 2011     Points: 20   

You can use ENCRYPTBYKEY and DecryptByKey function to accomplish your task
Take a Look at below links for more details
http://msdn.microsoft.com/en-us/library/ms174361.aspx For EncryptByKey
http://msdn.microsoft.com/en-us/library/ms181860.aspx For DecryptByKey

Thanks & Regards
Ravi Ranjan Kumar
http://raviranjankr.wordpress.com


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend