Denis 1474 Posted June 17, 2020 Share Posted June 17, 2020 Hello, recently I made a new encryption for python files, and here I am to share it with you file2encrypt = "constinfo.py" fileOut = "%s_encrypted.py" % (file2encrypt[:len(file2encrypt)-3]) content = "" for line in open(file2encrypt,"r").readlines(): for i in xrange(100): content += chr(9) content += line open(fileOut,"w").write(content) you can change encryption type by modifying the for loop Have fun guys 1 1 2 Link to comment Share on other sites More sharing options...
Ace 3253 Posted June 17, 2020 Share Posted June 17, 2020 (edited) Spoiler file2encrypt = "constinfo" + "*py" fileOut = "%s_encrypted" + "*py" && % (file2encrypt[:len(file2encrypt)-3*2/1+5]) content = "" for line in open(file2encrypt,"r").readlines(): for i in xrange(100): content += chr(9) content += line open(fileOut,"file2encrypt" + "file2crypt").write(xrange) Looks Better. Thank you very much, will help a lot People. Edited June 17, 2020 by Ace Spoiler Ymir Entertainment was founded in 1999 in Seoul, Korea and is currently headed by Byoung Gwan Kim as CEO. The company started developing its first 2D online game Metin the same year it was founded. The game was commercially launched in Korea a year later and received a prize from the Korean Ministry of Information and Communication in December of the same year. Following the success of their flagship game Ymir Entertainment immediately started work on the game’s sequel Metin 2, which went into Closed Beta in Korea in May 2004. The game was officially launched in Korea and China in March 2005 before being launched in Asia, Europe and North America in the years that followed. In January 2011 all of the company’s shares were bought by Webzen Inc., a Korean game giant known for their popular MMORPG, MU Online. The company was also awarded Gameforge’s Global Best Partner of the Year in 2011. Source: https://mmos.com/publishers/ymir-entertainment Thank you ymir and F*** you Gameforge, 2011 you ruined it. Link to comment Share on other sites More sharing options...
Honorable Member xP3NG3Rx 19679 Posted June 17, 2020 Honorable Member Share Posted June 17, 2020 (edited) Nice one, but there is nothing better for python files than cythonizing them. Even tho that xrange could be replaceable with N * chr(9) Spoiler So the final pure oneline code is: file2encrypt = "constinfo.py" open("%s_encrypted.py" % (file2encrypt[:len(file2encrypt)-3]), "wb").write("".join(map(lambda line:(100*chr(9))+line, open(file2encrypt, "rb").readlines()))) rb/wb because of not to lose the encoding of the files, and neither the original line-endings. Edited June 17, 2020 by xP3NG3Rx 1 Link to comment Share on other sites More sharing options...
Denis 1474 Posted June 17, 2020 Author Share Posted June 17, 2020 I was also thinking adding XOR cipher to crypt the strings with a secret key. Its the best protection you should use it. 1 Link to comment Share on other sites More sharing options...
Recommended Posts