https://github.com/zfi2/teavault
compile-time string encryption using the TEA algorithm
https://github.com/zfi2/teavault
compile-time cpp cryptography encryption header-only obfuscation reverse-engineering security string-encryption tea-cipher
Last synced: 3 months ago
JSON representation
compile-time string encryption using the TEA algorithm
- Host: GitHub
- URL: https://github.com/zfi2/teavault
- Owner: zfi2
- License: mit
- Created: 2025-03-04T20:09:25.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-03-04T20:22:40.000Z (3 months ago)
- Last Synced: 2025-03-04T21:21:49.580Z (3 months ago)
- Topics: compile-time, cpp, cryptography, encryption, header-only, obfuscation, reverse-engineering, security, string-encryption, tea-cipher
- Language: C++
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## teavault - a header-only compile-time string encryption functionality using the tiny encryption algorithm (tea).
## features
- compile-time encryption to resist reverse-engineering
- automatic or manual decryption at runtime
- order scrambling for additional obfuscation
- flexible key generation with optional custom seeds## how it works
the encryption uses the tea algorithm with a 128-bit key. by default, the key is generated using `__TIME__` and `__DATE__` preprocessor macros, ensuring a unique key for each compilation. you can also provide custom seed values to generate the key.## example usage
```cpp
#include
#include "tea_str.hpp"int main() {
// automatic decryption with default key generation
auto decrypted_str = tea_str("automatically decrypted string!");// manual decryption object
auto encrypted_obj = tea_str_m("manually decrypted string");// custom seed key generation
auto custom_seed_str = tea_str("custom seed example", 1234, 5678, 91011, 1213);std::cout << "automatic decryption: " << decrypted_str << "\n";
std::cout << "manual decryption: " << encrypted_obj.decrypt() << "\n";
std::cout << "custom seed decryption: " << custom_seed_str << "\n";return 0;
}
```## macro references
- `tea_str(str, ...)`: creates encrypted string with automatic decryption
- `str`: string to encrypt
- `...`: optional custom seed values- `tea_str_m(str, ...)`: creates encrypted string object for manual decryption
- `str`: string to encrypt
- `...`: optional custom seed values## key generation
the `key_generator::generate()` method creates a 128-bit key from:
- default: `__TIME__` and `__DATE__` preprocessor macros
- custom: user-provided seed values## license
this project is licensed under the MIT license. see the [LICENSE](LICENSE) file for details.