Created
February 8, 2019 14:26
-
-
Save andrew-wilkes/ae55448bd23a6d3518fd776202ec8bac to your computer and use it in GitHub Desktop.
Godot simple text file obfuscation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var d = File.new() | |
if d.file_exists(DIALOG_FILE): | |
encode_dialog() | |
d.open(ENC_DIALOG_FILE, File.READ) | |
dialog = flip_bytes(d.get_buffer(d.get_len())).get_string_from_utf8().split("###") | |
d.close() | |
func encode_dialog(): | |
var file = File.new() | |
file.open(DIALOG_FILE, File.READ) | |
var text = file.get_as_text() | |
file.close() | |
file.open(ENC_DIALOG_FILE, File.WRITE) | |
var p = flip_bytes(text.to_utf8()) | |
file.store_buffer(p) | |
file.close() | |
func flip_bytes(p): | |
for i in p.size(): | |
p[i] *= -1 | |
return p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Oh, and in my system, there is a delimiter of "###" between sections of text to allow them to be parsed into an array.