Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Encrypting a long string
Message
From
15/02/2019 08:57:48
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01666383
Message ID:
01666445
Views:
32
>When testing the use of the table PK as a seed, padded with '0's the encrypted string is different but very similar. Because most of the characters in seed are the same. For example, for PK 5 and PK 6. It would still make it very difficult to crack.
>I added another "twist" to this approach.
>Instead of using the PK as a seed, I use the PK*369 (or any other number that I won't share with anybody :)).
>The resulting number/seed then has more different characters than simply PK.
>Example:
>5*369=1845 - Seed "1845"
>6*369=2214 - Seed "2214"
>This way the Seed is even more difficult to guess, even if someone has the cipher() code.

Your solution was exactly what I was going to recommend after reading the first sentence. You nailed it. :-)

Another way to do this is to use something other than a random string. The data source to obscure the text only has to come from some source. You can use an image and read the RGB() colors from the image in a defined rectangle that your algorithm determines based on some combination of PK values. You then read each pixel, process the characters in sequence using the R channel (0..255), G channel, B channel, and then repeat. If you use a sufficiently noisy image, it would be very hard to decipher. You can also use a stride, so that you don't increase by 1 pixel each time, but move about the image from some starting point in a random jumping pattern.

Any kind of algorithm to read in seemingly random data, and then to augment the characters in that way, replacing the getRand() function with whatever algorithm you want to read in "random" things.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform