Latest 1.0.1
Homepage https://github.com/xxtea/xxtea-objc
License MIT
Authors

XXTEA for Objective-C

XXTEA logo

Join the chat at https://gitter.im/xxtea/xxtea-objc
CocoaPods
CocoaPods
CocoaPods

Introduction

XXTEA is a fast and secure encryption algorithm. This is a XXTEA library for Objective-C.

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

In addition to providing the API of NSData encryption and decryption, it also provides some methods to handle NSString and Base64 encode.

Installation

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

Usage

#import <Foundation/Foundation.h>
#import "XXTEA.h"

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        NSString *text = @"Hello World! 你好,中国!";
        NSData *key = [@"1234567890" dataUsingEncoding:NSASCIIStringEncoding];
        NSData *encrypt_data = [ xxteaEncrypt:key];
        NSData *decrypt_data = [encrypt_data xxteaDecrypt:key];
        if (strncmp(, decrypt_data.bytes, decrypt_data.length) == 0) {
            NSLog(@"success!");
        }
        else {
            NSLog(@"fail!");
        }
    }
    return 0;
}

Latest podspec

{
    "name": "xxtea",
    "version": "1.0.1",
    "summary": "XXTEA for Objective-C",
    "description": "XXTEA is a fast and secure encryption algorithm. This is a XXTEA library for Objective-C.nnIt is different from the original XXTEA encryption algorithm. It encrypts and decrypts NSData instead of 32bit integer array, and the key is also the NSData.nnIn addition to providing the API of NSData encryption and decryption, it also provides some methods to handle NSString and Base64 encode.",
    "homepage": "https://github.com/xxtea/xxtea-objc",
    "license": "MIT",
    "authors": {
        "andot": "[email protected]"
    },
    "source": {
        "git": "https://github.com/xxtea/xxtea-objc.git",
        "tag": "v1.0.1"
    },
    "source_files": [
        "src",
        "src/**/*.{h,m}"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This