https://github.com/xxtea/xxtea-java
XXTEA encryption algorithm library for Java.
https://github.com/xxtea/xxtea-java
Last synced: 8 months ago
JSON representation
XXTEA encryption algorithm library for Java.
- Host: GitHub
- URL: https://github.com/xxtea/xxtea-java
- Owner: xxtea
- License: mit
- Created: 2015-03-09T15:08:14.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2016-02-12T19:33:55.000Z (almost 10 years ago)
- Last Synced: 2023-11-13T09:42:12.638Z (about 2 years ago)
- Language: Java
- Size: 10.7 KB
- Stars: 124
- Watchers: 12
- Forks: 63
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-java - XXTEA Java
README
# XXTEA for Java
[](https://gitter.im/xxtea/xxtea-java?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[](https://maven-badges.herokuapp.com/maven-central/org.xxtea/xxtea-java/)
[](https://github.com/xxtea/xxtea-java/releases)
[](http://opensource.org/licenses/MIT)
## Introduction
XXTEA is a fast and secure encryption algorithm. This is a XXTEA library for Java.
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.
## Usage
```java
package org.xxtea.test;
import org.xxtea.XXTEA;
public class Main {
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);
assert(str.equals(decrypt_data));
}
}
```