Technical Article

Simple script to de-identify data

,

An audit finding relating to production data, containing customer identifiable data, in a UAT environment, prompted this simple script, which completely scrambles data in such a way that the original value can not be reconstituted.

create view dbo.random
as
select convert(int,rand()*10) random; /*the multiplier can be any number, I just used 10 to demo*/GO
CREATE OR ALTER FUNCTION dbo.scramble (@In NVARCHAR(4000))
RETURNS NVARCHAR(4000)
AS
BEGIN
declare @a nvarchar(4000)='',@li tinyint=0;
while @li < len(@In)
begin
select @a+= nchar(ascii(substring(@In,@li+1,1))^random) from dbo.random;
select @li+=1;
end
RETURN @a;
END
GO

select dbo.scramble ('absoltion z, ABSOLTION Z');

Rate

1 (2)

You rated this post out of 5. Change rating

Share

Share

Rate

1 (2)

You rated this post out of 5. Change rating