use fmt's %q to encode []byte literals
I now implemented and tested hex encoded strings, binary literals, and fmt.Sprintf("%q", data). In the case of garble all produce the exact same binary size. I decided to use %q because it is the simplest, leads to the smallest garbled code file size size of the three, and is faster at compile time than binary literals. It looks like: var ztN0xdMLL = garbleDecrypt([]byte("\xaf\xbd\x01\\&\x14\xab\xeb\x94\x10Q\xf2H#\xde\x17\a\x8f\x89MmZs\u0088\xcfw\xba?\x9e\xe1\x81\x1eպD\xe1@\xf2\x8d\xe3Ije\xca\bB\xbey\x8b")) From the fmt docs: String and slice of bytes (treated equivalently with these verbs): [...] %q a double-quoted string safely escaped with Go syntax Fixes #40.pull/45/head
parent
fdc7f97db8
commit
199d24d24f
Loading…
Reference in New Issue