Class or module encryption

Hello all!
If into the IDE I encrypt a class or a module, will it be decrypted when I compile my app or will it still be encrypted?
I ask this because sometimes I put into the code some passwords to connect automatically to (for example) a database server… but I don’t want that the password can be grabbed from anyone.

Many thanks!

You need to obfuscate passwords. People can find a “mySecurePassword1234” string looking into your binary. Encrypting your code just hides your source code from other people using a Xojo IDE.

You can use something like this to quickly obfuscate strings: https://thezaz.com/code/obfuscate/

If you need obfuscate all strings:

http://www.tempel.org/Arbed/StringObfuscation

Arbed seems very powerful to do everything automatically. I look forward to it can also obfuscate the client side for web applications. :slight_smile:

Many thanks for the answers. Very complete!

Olivier, I don’t think Arbed will ever do any encryption client-side, because that would probably require rewriting the Javascript code, and RS has not provided any means for that.

A simple IDE script to obfuscate selected text.
It’s not written by me, but I don’t remember where I got it. I just modified some bits.

[code]////////////////////////////////////////////////////////////////////////////////

// simple string obfuscation

////////////////////////////////////////////////////////////////////////////////

dim selectedText as string
dim obfuscatedText as string
dim obfuscChar as string
dim obfuscLineLen as integer
dim selectionStart as integer
dim currentCode as string
dim ascValue as integer
dim i, n as integer

const MAX_LINE_LEN = 80

if selLength > 0 then

selectedText = selText
selectionStart = selStart

if selLength > 1 and left(selectedText, 1) = “”"" and right(selectedText, 1) = “”"" then
selectedText = mid(selectedText, 2, len(selectedText) - 2)
end if

n = len(selectedText)
for i = 1 to n

if obfuscLineLen > MAX_LINE_LEN then
obfuscLineLen = 0
obfuscatedText = obfuscatedText + " _" + endOfLine
end if

if obfuscatedText <> “” then
obfuscatedText = obfuscatedText + “+”
obfuscLineLen = obfuscLineLen + 1
end if

ascValue = asc(mid(selectedText, i, 1))

if ascValue < 128 then
obfuscChar = “chr(” + str(ascValue) + “)”
else
obfuscChar = “encodings.UTF8.chr(” + str(ascValue) + “)”
end if
obfuscLineLen = obfuscLineLen + len(obfuscChar)

obfuscatedText = obfuscatedText + obfuscChar

next

selText = obfuscatedText

currentCode = Text

i = selectionStart
while i > -1
if mid(currentCode, i, 1) = endOfLine then
if mid(currentCode, i-1, 1) <> “_” then
exit
end if
end if
i = i -1
wend

currentCode = left(currentCode, i) _

  • "// obfuscated string = " + selectedText + endOfLine _
  • mid(currentCode, i+1)

Text = currentCode

end if[/code]

ok, thank you Thomas.