Skip to content

Latest commit

 

History

History
41 lines (29 loc) · 1.1 KB

README.md

File metadata and controls

41 lines (29 loc) · 1.1 KB

XXTEA for .NET

XXTEA logo

Introduction

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

It is different from the original XXTEA encryption algorithm. It encrypts and decrypts Byte[] instead of 32bit integer array, and the key is also the Byte[].

In addition to providing the API of Byte[] encryption and decryption, it also provides some methods to handle String and Base64 encode.

Installation

git clone https://github.com/xxtea/xxtea-dotnet.git

Usage

using System;
using System.Diagnostics;
using Xxtea;

namespace Example {
    class MainClass {
        public static void Main (string[] args) {
            String str = "Hello World! 你好,中国!";
            String key = "1234567890";
            Byte[] encrypt_data = XXTEA.Encrypt(str, key);
            String decrypt_data = XXTEA.DecryptToString(encrypt_data, key);
            Debug.Assert(str == decrypt_data);
        }
    }
}