Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # XORIFY CRYPT SYSTEM ... (by Narzew)
- # Creative Commons License
- #Very old..
- #Non-safe
- #8x more size of the crypted file
- #For educational purposes only :)
- def xorify_crypt(source, destination, key=0x0AEEF6)
- file = File.open(source, "rb")
- data = file.read
- file.close
- s = []
- xorval = key
- data.each_byte{|byte|
- r = byte.to_i ^ xorval
- s << r
- xorval = xorval * 2 + 113 & 0xFFFFFFFF
- }
- $data = s
- file = File.open(destination, 'wb')
- Marshal.dump($data, file)
- file.close
- end
- def xorify_decrypt(packed,dest,key=0x0AEEF6)
- file = File.open(packed, 'rb')
- $data = Marshal.load(file)
- s = []
- xorval = key
- $data.each{|x|
- r = x ^ xorval
- s << r
- xorval = xorval * 2 + 113 & 0xFFFFFFFF
- }
- a = []
- s.each{|x|
- a << x.chr
- }
- script = a.to_s
- file = File.open(dest,'wb')
- file.write(script)
- file.close
- end
- def xorify_eval(packed, key=0x0AEEF6, raiseonfailure=0)
- file = File.open(packed, 'rb')
- $data = Marshal.load(file)
- s = []
- xorval = key
- $data.each{|x|
- r = x ^ xorval
- s << r
- xorval = xorval * 2 + 113 & 0xFFFFFFFF
- }
- a = []
- s.each{|x|
- a << x.chr
- }
- script = a.to_s
- begin
- eval(script)
- rescue
- raise("Failed to load script") if raiseonfailure == 1
- print("Failed to load script") if raiseonfailure == 0
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement