#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ #_/ ◆ File Encrytion 2 - KGC_FileEncryption2 ◆ XP/VX ◆ #_/ ◇ Last Update: 2006/11/27 #_/ ◆ Written by TOMY #_/ ◆ Translation by Mr. Anonymous #_/ ◆ KGC Site: #_/ ◆ http://ytomy.sakura.ne.jp/ #_/ ◆ Translator's Blog: #_/ ◆ http://mraprojects.wordpress.com #_/---------------------------------------------------------------------------- #_/ Installation: Insert above Main, below KGC_InterfaceForWin32API. #_/ Requires TCrypt.dll #_/============================================================================ #_/ This script encrypts your game data to an unhackable state. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ =begin ━━━━━━━━━━━━━━━━━━━ Methods ━━━━━━━━━━━━━━━━━━━━ ┠─── Module - TCrypt ─────────────────────────── ┃ version() ┃ - no arguments - ┃ Returns the version of "TCrypt.dll" by Integer. ┃ ┃ encrypt(infile, outfile, key, mode[, bufsize]) ┃ infile : Input file. ┃ ┃ outfile : Output file. ┃ ┃ key : Encryption key. ┃ ┃ mode : Encryption mode. ┃ << 0..MKERS 1..MKES >> ┃ ┃ bufsize : Buffer size. (Default: 4096Byte) ┃ ┃ ┃ Encrypts 'infile', and outputs it to 'outfile'. ┃ ┃ decrypt(infile, outfile, key, mode[, bufsize]) ┃ infile : Input file. ┃ ┃ outfile : Output file. ┃ ┃ key : Encryption key. ┃ ┃ mode : Encryption mode. ┃ << 0..MKERS 1..MKES >> ┃ ┃ bufsize : Buffer size. (Default: 4096Byte) ┃ ┃ Decrypts 'infile', and outputs it to 'outfile'. ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ =end $imported = {} if $imported == nil $imported["FileEncryption2"] = true module TCrypt # Code page CP_UTF8 = 65001 # UTF-8 # Encryption mode MODE_MKERS = 0 # MKERS MODE_MKES = 1 # MKES module_function #-------------------------------------------------------------------------- # ○ [TCrypt.dll] aquired and converted # (Example: 1.23 → 123) #-------------------------------------------------------------------------- def version begin api = Win32API.new('TCrypt.dll', 'DllGetVersion', %w(v), 'l') ret = api.call rescue ret = -1 end return ret end #-------------------------------------------------------------------------- # ○ Encrytion # infile: Input file name # outfile: Output file name # key: Encryption key # mode: Encryption form # bufsize: Size of buffer(16~1048576) #-------------------------------------------------------------------------- def encrypt(infile, outfile, key, mode, bufsize = 4096) begin api = Win32API.new('TCrypt.dll', 'EncryptA', %w(l p p p l l l), 'l') ret = api.call(0, infile, outfile, key, mode, bufsize, CP_UTF8) rescue ret = -1 end return ret end #-------------------------------------------------------------------------- # ○ Decoding # infile: Input file name # outfile: Output file name # key: Encryption key # mode: Encryption form # bufsize: Size of buffer(16~1048576) #-------------------------------------------------------------------------- def decrypt(infile, outfile, key, mode, bufsize = 4096) begin api = Win32API.new('TCrypt.dll', 'DecryptA', %w(l p p p l l l), 'l') ret = api.call(0, infile, outfile, key, mode, bufsize, CP_UTF8) rescue ret = -1 end return ret end end