• Stars
    star
    112
  • Rank 311,029 (Top 7 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 10 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

XXTEA encryption algorithm library for PHP.

XXTEA for PHP

XXTEA logo

Build Status Packagist Packagist Download License

Introduction

XXTEA is a fast and secure encryption algorithm. This is a XXTEA library for PHP.

It is different from the original XXTEA encryption algorithm. It encrypts and decrypts string instead of uint32 array, and the key is also string.

Installation

Download the xxtea.php, and put it in your develepment directory.

Usage

<?php
    require_once("xxtea.php");
    $str = "Hello World! 你好,中国!";
    $key = "1234567890";
    $encrypt_data = xxtea_encrypt($str, $key);
    $decrypt_data = xxtea_decrypt($encrypt_data, $key);
    if ($str == $decrypt_data) {
        echo "success!";
    } else {
        echo "fail!";
    }
?>