lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


>>>>> respected experts what is the exact method to encryption my code
>>>>> written in androidlua language [...]

This really depends on what you mean by "encryption".

"Encryption" is a technical term with a fairly precise meaning, but it
also is an everyday term with a much looser meaning.

When you write

>>> Actually I want that if I send this code to someone, the other
>>> person will not be able to understand what is written in this code
>>> and how this code is generated.  But do the work perfectly when
>>> running the [code ...]

If your adversary is skilled and determined enough, this is not
possible.  If the code can run, it can be understood.  The most you can
do is make it more difficult.  (Unless your target machine supports
some kind of hardware-secured encrypted execute-only mode; if your
objective is for more-or-less arbitrary Android users to run the code,
this is not an option.)

There is a process in the JavaScript world called "minification" (with
related words such as the adjective "minified").  This is probably
enough for most people.  For this, you do things like removing all
whitespace not actually required by the syntax and replacing all
identifiers with meaningless names such as "a", "b", "c", "d", etc.
This sort of thing is more correctly called obfuscation rather than
encryption.

In something as small as what you quote, it is difficult to do much,
especially since your code doesn't actually do much.  A minified
version of it would look something like

Http.get("https://www.urdupoint.com/sports/series/215/asia-cup-2023-schedule.html";,
function(a,b)if a==200 then for c,d,e,f,g result:gmatch('<span
class="fix_match_num">(.-)</span>.-<div
class="fixb1">.-<h4>(.-)</h4>.-<p
class="fix_match_dtime">(.-)</p>.-<p
class="fix_match_stadium">(.-)</p>.-<div
class="fixb3">.-<h4>(.-)</h4>') do
print(c,"\n\n",d,"vs",g,"\n\n",f,"\n\n",e) end else print("The page was not found")
end end)

which doesn't really help much.  You could compress, or otherwise
obfuscate, the strings, but the code to undo that would probably be
bigger than the actual code.

If you know enough about your target machines, you could ship
luac-compiled bytecode instead of source.  Like obfuscating the source,
this does not make it impossible for someone to reverse-engineer the
code; it just makes it more difficult.

Furthermore, given the simplicity of your code, it's entirely plausible
that someone could reverse-engineer it without looking at the code at
all, simply by observing its behaviour (in this case the network
traffic it generates).

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse@rodents-montreal.org
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B