Does Xojo code editor have a max number of columns?

Hey, I am trying to obfuscate a pretty long string that is a sql dump to recreate some tables in an in memory sqlite db. The string is about 1 million characters and obfuscated character arrays go to several million columns. I was using an ide script that copies to clipboard and there is no issue copying, I can paste in other text editors just fine but when I try to paste into Xojo or Arbed, it hangs forever. Doesn’t seem like such a string should really kill the program like this, is there a max column limit that this is hitting or something? I am going to try and do it in chunks and concat, but would be good to know if there’s a limit to determine chunk size… Thanks!

that statement contradicts itself… .how can you string be 1million characters, yet contain arrays that are several million each??

what is the sum total size of the chunk of data you are attempting?

You can save the string in a text file and drag the file into the IDE. It will become a string constant named with the file name. Or, have you tried pasting it into a constant?

Dave, I think you misread his statement. He has a million character string and an obfuscated string (a character array) that is millions of characters.

[quote=406482:@Tim Hare]You can save the string in a text file and drag the file into the IDE. It will become a string constant named with the file name. Or, have you tried pasting it into a constant?

Dave, I think you misread his statement. He has a million character string and an obfuscated string (a character array) that is millions of characters.[/quote]

Thanks Tim, but I made some confusion by referring to what I was getting out as just a string. I am using a method found in the forums (posted by Kem) that turns each character into a number doing some math, then the result is actually 3 very long arrays and the function combining them that I am trying to paste back into Xojo to execute. It handles many lines just fine, but not the very long columns. Is it just me or some kind of limitation? It doesn’t seem to be taking much resources, just stops responding. I guess I’ll try another platform now as well …

What version of Xojo are you using on which platform?

2018 r2 on win 10 64 bit

The code viewer in the IDE has a heart attack at “just” ( :wink: ) 10’000 characters on a line. The line shows as split across a few lines when you are on the left side of the scrollbar. You go to the end of the line and its not rendered if you shift+cursor left it shows characters, bit it a mess. At 100k characters on a line it doesn’t show anything but shift+arrow works. Oh, its blown up now with ctrl+home.

Thanks, sounds like it’s gonna be a pain the ■■■■

As Tim mentioned earlier. Cant you paste the three parts of the array into the IDE using the 3 window properties or consts? I’ve just put 100k numbers in there and it seems fine.

Can you post a link to the function you’re using and we might be able to adapt it for you.

[quote=406590:@JulianS]As Tim mentioned earlier. Cant you paste the three parts of the array into the IDE using the 3 window properties or consts? I’ve just put 100k numbers in there and it seems fine.

Can you post a link to the function you’re using and we might be able to adapt it for you.[/quote]

Actually, it seems like you can’t put an array into constants? In default value I put ARRAY(1,2) , name is test() and syntax error. And as a property, it recognizes as Nil like you said after some characters (even though when you highlight they are actually there)

Here’s the function I am using for reference (from here https://forum.xojo.com/12423-obfuscation)

[code] Function RndInRange (startIndex As Integer, endIndex As Integer) As Integer
dim d as Double = Rnd
dim range as Integer = endIndex - startIndex
return Round( range * d ) + startIndex
End Function

dim origString as String = SelText
if origString.Trim = “” then
print “Select some text first.”
return
end if

origString = origString.ReplaceAll( “”"""", “”"" )
dim chars() as String = Split( origString, “” )

dim startQuote as boolean = chars( 0 ) = “”""
dim endQuote as boolean = chars( chars.Ubound ) = “”""

if endQuote then
chars.Remove chars.Ubound
end if

if chars.Ubound <> -1 and startQuote then
chars.Remove 0
end if

if chars.Ubound = -1 then
print “Select some valid text first.”
return
end if

dim stringToEncode as String = Join( chars, “” )
dim b as String = ShowDialog( “You are about to encode this string. Proceed?”, stringToEncode, “Yes”, “No”, “” )
if b = “No” then
return
end if

dim index as Integer
dim codeArr() as String
dim indexArr() as String
dim addArr() as String
dim randomizerArr() as Integer
for index = 0 to chars.Ubound
dim thisAdd as Integer = RndInRange( 64001, 100000 )
codeArr.Append Str( Asc( chars( index ) ) + thisAdd )
indexArr.Append Str( index )
addArr.Append Str( thisAdd )
randomizerArr.Append RndInRange( 0, chars.Ubound * 100 )
next index

randomizerArr.SortWith( codeArr, indexArr, addArr )

// Construct the code
dim eol as String = EndOfLine
dim resultArr() as String

resultArr.Append “dim decodedString as String”
resultArr.Append eol
resultArr.Append eol

resultArr.Append "// Encoding for value: "
resultArr.Append stringToEncode
resultArr.Append eol

resultArr.Append “if True then”
resultArr.Append eol

resultArr.Append "dim codeArr() as Integer = Array( "
resultArr.Append Join( codeArr, “, " )
resultArr.Append " )”
resultArr.Append eol

resultArr.Append "dim adderArr() as Integer = Array( "
resultArr.Append Join( addArr, “, " )
resultArr.Append " )”
resultArr.Append eol

resultArr.Append "dim indexArr() as Integer = Array( "
resultArr.Append Join( indexArr, “, " )
resultArr.Append " )”
resultArr.Append eol

resultArr.Append “indexArr.SortWith codeArr, adderArr”
resultArr.Append eol

resultArr.Append eol

resultArr.Append “dim decodedChars() as String”
resultArr.Append eol

resultArr.Append “for i as Integer = 0 to codeArr.Ubound”
resultArr.Append eol

resultArr.Append “decodedChars.Append Chr( codeArr( i ) - adderArr( i ) )”
resultArr.Append eol

resultArr.Append “next i”
resultArr.Append eol

resultArr.Append eol

resultArr.Append “decodedString = Join( decodedChars, “””" )"
resultArr.Append eol

resultArr.Append “end if // True”
resultArr.Append eol

resultArr.Append "// End Encoding for value: "
resultArr.Append stringToEncode
resultArr.Append eol

dim result as String = Join( resultArr, “” )

b = ShowDialog( “Paste into this method or Copy to clipboard?”, result, “Paste”, “Cancel”, “Copy” )
select case b
case “Cancel”
return
case “Copy”
Clipboard = result
case “Paste”
// See if we need the initial declaration
if Text.InStr( resultArr( 0 ) ) <> 0 then
for index = 1 to 2
resultArr.Remove 0
next index
result = Join( resultArr, “” )
end if

// Figure out where we should paste
dim curText as String = Text
dim curSelStart as Integer = SelStart
dim newSelStart as Integer
for index = curSelStart downto 1
  dim curChar as String = curText.Mid( index, 1 )
  if curChar = Chr( 13 ) or curChar = Chr( 10 ) then
    newSelStart = index
    exit
  end if
next index

SelText = "decodedString"
SelStart = newSelStart
SelLength = 0
SelText = result
SelText = eol

end select[/code]

That ends badly with as many characters as you plan to use it with.

I altered the script above to add an entry per line and the IDE isn’t able to cope with this amount of code either in columns or rows, even with around 30000 rows of code (10’000 characters) it starts taking a second to type something.

I don’t know the best route for you to take as you might be better off obfuscation it then turning it into a a base64 encoded string that you could paste into a const or having it as an encrypted file that you load in at runtime.

On a side note, this is circumvented using a debugger as you just stop the code as it reassembles the string.