GithubHelp home page GithubHelp logo

menezes- / xxtea Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 35 KB

Implementation of the (corrected) Block TEA encryption algorithm in modern C++ with PHP bindings

CMake 1.88% C++ 62.71% Makefile 35.41%
cpp xxtea xxtea-algorithm cryptography cpp11 xtea xtea-cipher php php-extension

xxtea's Introduction

xxtea

Implementation of the corrected Block TEA 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

#include <iostream>
#include "xxtea.hpp"

int main() {
  std::string secret{"super secret string"};
  
  auto encrypted = xxtea::encrypt(test, "hunter2");
  // encrypted is a std::vector<std::uint32_t>, 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 installed. Once you have PHP-CPP installed build and install the PHP extension is very simple:

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

xxtea's People

Contributors

emiro85 avatar menezes- avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.