How to encrypt a string at compile-time and decrypt it at runtime in Rust, similar to constexpr encryption in c++?

74 Views Asked by At

In c++, It's possible to use some tricks with the help of constexpr, to write a MACRO that encrypts strings in compile-time, and decrypts them in runtime, and we could use something like ENCRYPT("MyString") to achieve this. An example is the following header file:

https://github.com/skadro-official/skCrypter/blob/master/files/skCrypter.h

Is this also possible in Rust? I want to encrypt my strings in compile time, and decrypt them in runtime.

0

There are 0 best solutions below