ios简单加密

2018-04-30  本文已影响38人  师傅我坚持不住了

WKCEncryptor

Some base on encryptor

pod 'WKCEncryptor'
#import <WKCEncryptor/WKCEncryptor.h>

MD5加密

NSString *test = @"你我他";
NSString *testMD5 = [test MD5];
//result: 23b3e52000cbb65f4f39f3c22cbeb8b2

base64加解密

NSString *test = @"你我他";
NSString *testBase64 = [test base64EncodeString];
//result: 5L2g5oiR5LuW
NSString *testGeBase64 = [testBase64 base64DecodeString];
//result: @"你我他"

AES256数据加解密

NSString *test = @"你我他";
NSData *data = [test dataUsingEncoding:NSUTF8StringEncoding];
NSData *encryptor =[data AES256EncryptWithKey:@"AES256"];
NSData *gencryptor = [encryptor AES256DecryptWithKey:@"AES256"];

keyChain

[WKCKeyChain saveAccount:@"账号" passWord:@"密码"] ;
NSString *password = [WKCKeyChain sharedKeyChain].passWord;
NSString *account = [WKCKeyChain sharedKeyChain].account;
//result: @"密码"  @"账号"

如有问题或bug,请私信.github地址

上一篇下一篇

猜你喜欢

热点阅读