Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/menezes-/xxtea
Implementation of the (corrected) Block TEA encryption algorithm in modern C++ with PHP bindings
https://github.com/menezes-/xxtea
cpp cpp11 cryptography php php-extension xtea xtea-cipher xxtea xxtea-algorithm
Last synced: 29 days ago
JSON representation
Implementation of the (corrected) Block TEA encryption algorithm in modern C++ with PHP bindings
- Host: GitHub
- URL: https://github.com/menezes-/xxtea
- Owner: menezes-
- Created: 2019-10-04T17:13:24.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-29T22:39:10.000Z (over 3 years ago)
- Last Synced: 2023-02-27T06:41:09.512Z (over 1 year ago)
- Topics: cpp, cpp11, cryptography, php, php-extension, xtea, xtea-cipher, xxtea, xxtea-algorithm
- Language: C++
- Homepage:
- Size: 34.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# xxtea
Implementation of the [corrected Block TEA](https://en.wikipedia.org/wiki/XXTEA) encryption algorithm in modern C++.It focuses on encrypting strings but it can be easily modified to encrypt binary data (take a look at the `encode` and `decode` functions).
This is a header only library so you just need to copy `xxtea.hpp` to your src folder and `#include` it.
## Usage
```cpp
#include
#include "xxtea.hpp"int main() {
std::string secret{"super secret string"};
auto encrypted = xxtea::encrypt(test, "hunter2");
// encrypted is a std::vector, you can serialize however you want (an example of that is in the xxtea-php.cpp file)
// if your password is less than 128 bits it will be padded
std::cout << xxtea::decrypt(encrypted, "hunter2") << '\n';
return 0;
}
```## PHP extension
There's also a PHP extension inside xxtea-php, you can compile it using CMake. To be able to compile it you must have [PHP-CPP](https://github.com/CopernicaMarketingSoftware/PHP-CPP) installed.
Once you have PHP-CPP installed build and install the PHP extension is very simple:
```bash
make
sudo make install
# enable it on your php installation eg:
sudo cp xxtea.ini /usr/local/etc/php/conf.d/
```
And you're done