  rem -- A fairly secure VDS text encryption routine. We assign the char
  rem -- found in %a to the same position in %b. The kicker here is that
  rem -- we do it an incremented amount of times (using %%c1) for each
  rem -- char up to %%max. For example: char1 is encrypted 1 time, char2
  rem -- is encrypted 2 times, etc., up to %%max (5 in this example) then
  rem -- we start back with 1 again. This way, double letters are not the
  rem -- same, and even the same words are different unless located at
  rem -- the same char position in a line. Also, %%max can be any integer.

  rem -- This example just has the alphanumerics in %b moved to the end,
  rem -- and @chr(34) to the front. You could scramble the whole %b string.

  rem -- This example does one line, but a file could be loaded to a list
  rem -- and looped thru to encrypt it. Note that the larger %%max is, the
  rem -- slower the routine, but the more secure the encryption. The routine
  rem -- is case-sensitive, has 8 user defined vars and 3 standard vars.

  rem -- Create 2 opposing 95 char strings, using @chr(34) for quote --
  %a = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~!@#$%^&*()-=_+[]{};':,./<>?\| "@chr(34)
  %b = @chr(34)"`~!@#$%^&*()-=_+[]{};':,./<>?\| 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

  rem -- This sets complexity of the encryption, should be 2 minimum --
  %%max = 5

  %%line = @input(Enter a word or phrase, "33333 aaaa rabbit rabbit")
  if @not(%%line)
    EXIT 
  end 

:Test
  rem -- Encrypt %%line --
  GOSUB Encrypt/Decrypt
  INFO Encrypt Test:@cr()@cr()"Entry    "%%line@cr()@cr()"Result    "%%line2

  rem -- Swap %a and %b for Decrypt --
  %c = %a
  %a = %b
  %b = %c

  rem -- Copy encrypted line to %%line for Decrypt --
  %%line = %%line2

  rem -- Decrypt %%line --
  GOSUB Encrypt/Decrypt
  INFO Decrypt Test:@cr()@cr()"Entry    "%%line@cr()@cr()"Result    "%%line2
  EXIT 

:Encrypt/Decrypt
  %%c1 = 1
  %%line2 = ""
  %%x1 = 1
  REPEAT 
    %%char = @substr(%%line, %%x1)
    %%x2 = 1
    REPEAT 
      %%x3 = 1
      REPEAT 
        if @numeric(%%char)
          if @equal(%%char, @substr(%a, %%x3))
            %%char = @substr(%b, %%x3)
            %%x3 = @len(%a)
          end 
        else 
          if @equal(%%char, @substr(%a, %%x3), EXACT)
            %%char = @substr(%b, %%x3)
            %%x3 = @len(%a)
          end 
        end 
        %%x3 = @succ(%%x3)
      UNTIL @greater(%%x3, @len(%a))
      %%x2 = @succ(%%x2)
    UNTIL @greater(%%x2, %%c1)
    %%line2 = %%line2%%char
    if @greater(%%max, %%c1)
      %%c1 = @succ(%%c1)
    else 
      %%c1 = 1
    end 
    %%x1 = @succ(%%x1)
  UNTIL @greater(%%x1, @len(%%line))
  exit 
