wie schon angemerkt bin ich noch blutiger Anfänger im Programieren.
Hier nun mein nächstes Problem:
Ich habe das folgende Lua-Script, das encryptete Texte innerhalb einer Datei entschlüsselt:
Code: Alles auswählen
function _aXqC1(str)
local res = ""
local dtable = "\r)=9\f\aK\",i{SrX#qLa0@Z8&:\014\030;d?\bA(\026G!\023b\000x\021jm 5\022$+s\025l\029<N^2\005WE\017M\vR]\003C\020_o1~keTvYH\002.\004zV\027\019Ptc\028\0063p\016IJ-O\n6\t\0157/\001h`uUByfDn[\018\031g>\024*|'4}w%QF\\"
for i = 1, #str do
local b = str:byte(i)
if b > 0 and b <= 127 then
res = res .. string.char(dtable:byte(b))
else
res = res .. string.char(b)
end
end
return res
end
print (_aXqC1("\fVg\n2\028+*\nU+\021\018g2Ho"))
Dieses versuche ich nun in Python zu übersetzen:
Code: Alles auswählen
def _aXqC1(string):
res = ""
dtable =r"\r)=9\f\aK\",i{SrX#qLa0@Z8&:\014\030;d?\bA(\026G!\023b\000x\021jm 5\022$+s\025l\029<N^2\005WE\017M\vR]\003C\020_o1~keTvYH\002.\004zV\027\019Ptc\028\0063p\016IJ-O\n6\t\0157/\001h`uUByfDn[\018\031g>\024*|'4}w%QF\\"
for i in range(1,len(string)):
b = ord(string[i])
if b > 0 and b <= 127:
res = res + chr(ord(dtable[b]))
else:
res = res + chr(b)
return res
text_decrypted = _aXqC1 (r"\fVg\n2\028+*\nU+\021\018g2Ho")
print (text_decrypted)
Es wäre sehr nett, wenn mir jemand sagen könnte, was ich falsch gemacht habe und wie ich den Fehler beheben kann!
Gruss
archifox