Welcome :Guest

Congratulations!!!

Top 5 Contributors of the Month
yasminpriya
Gaurav Pal
Ram
christianasteves

 Home >> Forum >> Sql Server >> Post New Question Subscribe to Forum
Author: Gowthammanju
Posted Date: June 28, 2011     Points: 20

Hey

plz find attachment below

this may help u

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)ASBEGIN	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	@CipherEND`

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

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