xxtea

XXTEA encryption algorithm library for Objective-C.

Showing:

Popularity

Downloads/wk

0

GitHub Stars

39

Maintenance

Last Commit

1yr ago

Contributors

1

Package

Dependencies

0

License

MIT

Categories

Readme

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 = [[text dataUsingEncoding:NSUTF8StringEncoding] xxteaEncrypt:key];
        NSData *decrypt_data = [encrypt_data xxteaDecrypt:key];
        if (strncmp([text UTF8String], decrypt_data.bytes, decrypt_data.length) == 0) {
            NSLog(@"success!");
        }
        else {
            NSLog(@"fail!");
        }
    }
    return 0;
}

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100