CREATE FUNCTION [dbo].[Decrypt] ( @EncryptedString NVARCHAR(4000) )
RETURNS VARCHAR(4000) WITH ENCRYPTION AS
BEGIN
DECLARE @vClearString VARCHAR(4000)
DECLARE @vIdx INT
DECLARE @vBaseIncrement INT
SET @vIdx = 1
SET @vBaseIncrement = 128
SET @vClearString = ''''
WHILE @vIdx <= LEN(@EncryptedString)
BEGIN
SET @vClearString = @vClearString +
CHAR(UNICODE(SUBSTRING(@EncryptedString, @vIdx, 1)) -
@vBaseIncrement - @vIdx + 1)
SET @vIdx = @vIdx + 1
END
RETURN @vClearString
To encrypt check following...
i've found this helpful. keep it up.
ReplyDelete