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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Scramble Data

Status
Not open for further replies.
Nov 21, 2000
26
0
0
US
I have a strange requirement to take data from a MSSQL database alow the user to export it and then re-import it later. The Export and Import are done, however one of the fields that they are allowed to export must be "scrabmled" so that the user can not utilize it. The data is stored in a field with a data type of float.

What I need to be able to do is scramble the data so that they can not use it, but when they re-import it into my server at a later date I can un-scramble it.

Does anybody have any ideas on easy ways to do this?
 
Well, this is simple, and hardly passes the first quiz in cryptology 101, but...

Pick your precision. If you need 4 decimal places:

flVal = ...
lngVal = CLng(10000 * flVal)
strVal = StrReverse(Hex(lngVal))

Then send the strVal to the user. To decode:

strVal = ...
lngVal = CLng("&H" & StrReverse(strVal))
flVal = lngVal / 10000

If your scaled value won't fit easily in a Long you need another trick.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top