https://github.com/xxtea/xxtea-nim
XXTEA for encryption algorithm library Nim.
https://github.com/xxtea/xxtea-nim
Last synced: 22 days ago
JSON representation
XXTEA for encryption algorithm library Nim.
- Host: GitHub
- URL: https://github.com/xxtea/xxtea-nim
- Owner: xxtea
- License: mit
- Created: 2016-02-17T00:40:52.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-05-24T07:46:25.000Z (about 4 years ago)
- Last Synced: 2024-08-04T03:07:04.345Z (10 months ago)
- Language: HTML
- Size: 162 KB
- Stars: 19
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-nim - xxtea - XXTEA encryption algorithm library. (Algorithms / Cryptography)
README
# XXTEA for Nim
[](https://travis-ci.org/xxtea/xxtea-nim)
## Introduction
XXTEA is a fast and secure encryption algorithm. This is a XXTEA library for Nim.
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
```sh
nimble install https://github.com/xxtea/xxtea-nim.git
```## Usage
```nim
import xxteaconst text = "Hello World! 你好,中国!"
const key = "1234567890"
const encrypt_data = xxtea.encrypt(text, key)
const decrypt_data = xxtea.decrypt(encrypt_data, key)
if text == decrypt_data:
echo "success!"
else:
echo "fail!"
```