Skip to content

XXTEA encryption algorithm library for Python

License

Notifications You must be signed in to change notification settings

cha0sCat/xxtea-python

 
 

Repository files navigation

XXTEA for Python

Build Status PyPI PyPI PyPI PyPI PyPI PyPI PyPI PyPI

Introduction

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

It is based on CFFI, so it is fast and support both cpython and pypy.

It is different from the original XXTEA encryption algorithm. It encrypts and decrypts raw binary data instead of 32bit integer array, and the key is also the raw binary data.

Installation

pip install xxtea-py

Usage

Python2:

import xxtea
text = "Hello World! 你好,中国!"
key = "1234567890"
encrypt_data = xxtea.encrypt(text, key)
decrypt_data = xxtea.decrypt(encrypt_data, key)
print(text == decrypt_data);

Python3:

import xxtea
text = "Hello World! 你好,中国!"
key = "1234567890"
encrypt_data = xxtea.encrypt(text, key)
decrypt_data = xxtea.decrypt_utf8(encrypt_data, key)
print(text == decrypt_data);

About

XXTEA encryption algorithm library for Python

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 64.8%
  • Python 35.2%