JustasMasiulis / xorstr

heavily vectorized c++17 compile time string encryption.
Apache License 2.0
1.21k stars 194 forks source link

Add macros for ASCII and Unicode strings #2

Closed no-realm closed 6 years ago

JustasMasiulis commented 6 years ago

Names starting with underscore are reserved in global namespace so I don't think having 2 character length macros with one might be the best idea.

I guess I would agree to the pull request if we though up better names for them but that is rather hard if you want something shorter and understandable at a glance

no-realm commented 6 years ago

@JustasMasiulis I agree that the macro names in the current PR are not ideal and I only used them, since that's what I used in my previous implementation for compile-time string obfuscation/encryption. Maybe we could use xstr(), axstr() and wxstr. Implementation being:

#define xstr(str) xorstr(str).crypt_get()
#define axstr xstr
#define wxstr(str) xorstr(L##str).crypt_get()

If you have any better suggestions, feel free to mention them.

JustasMasiulis commented 6 years ago

Hmm. There is a saying that naming things is the hardest part of computer science.

To have something similar to the current xorstr how about xorstr_ which adds the crypt_get(). Don't really like the wide strings idea as you are saving only 1 character and will get error if you miss it.