Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Encryption

Status
Not open for further replies.

jimmYLepp

Programmer
Jan 22, 2002
39
US
Does anyone know how to encrypt all of the data in a column in a table in SQL Server 7.0/2000?


Later jimmY
 
ALTER FUNCTION uf_XEncrupt (@src VARCHAR (128), @key VARCHAR (128))
RETURNS VARCHAR (128)
AS


BEGIN
DECLARE @encryptedvalue varchar(128),
@charpos smallint,
@srcpos smallint
SELECT @encryptedvalue = '',
@charpos = 1,
@srcpos = 1
WHILE (@charpos <= datalength(@src))
BEGIN
SELECT @encryptedvalue = @encryptedvalue + char(ascii(substring(@src, @charpos, 1) ) ^ ascii(substring(@key, @srcpos, 1))),
@charpos = @charpos + 1,
@srcpos = @srcpos + 1
IF @srcpos > len(@key)
SELECT @srcpos = 1
END
RETURN @encryptedvalue
END


Thanks

J. Kusch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top