mikebeargie

context-free data scrambler

Discussion created by mikebeargie Expert on Apr 18, 2013
Latest reply on Apr 19, 2013 by mikebeargie

I'm looking into making a script that will go through an entire database, and replace all the data with random strings.

 

I'm already able to do the replace function I want, making an alternative of this function http://www.briandunning.com/cf/533 that will replace numbers with random numbers, and text strings with random text (respecting spaces).

 

but I'm still wondering if it's possible to make this context free and fast. I'd ideally want to drop this custom function and script into a file, run it, and have all the data in the entire file replaced with random text. Basically, I want to clone a file, but replace the data with random data for security purposes. Assume also I am running this on raw data layouts, or a data separation file.

 

So I came up with something like:

 

set var $iteration = 1

LOOP

go to layout by number = $iteration

set var $fieldlist = FieldNames ( Get ( FileName ) ; Get ( LayoutName ) )

set var $fieldcount = ValueCount ($fieldlist)

show all records

Go To Record first

LOOP

set var $subiteration = 1

LOOP

Set Field By Name - GetValue ($fieldlist ; $subiteration) = RandomizeIt(self)

Set var $subiteration = $iteration + 1

Exit loop if $subiteration > $fieldcount

END LOOP

go to record next, exit after last

END LOOP

set var $iteration = $iteration + 1

exit loop if $iteration > layouts running this script on

END LOOP

 

Anyone have thoughts on this, or have you done soemthing similar to obfuscate your data? This is workable for me (more complex needed for error checking and such), but runs slowly due to the use of subloops, as you can't do a replace field contents command based on a calculated field name.

Outcomes