Viewcontroller.m
////VIEWCONTROLLER.M//Base64////Created by Dllo on 16/1/12.//copyright©2016 year Haiteng. All rights reserved.//#import "ViewController.h"#import "GTMBase64.h"@interfaceViewcontroller ()@end@implementationViewcontroller- (void) viewdidload {[Super viewdidload]; Self.view.backgroundColor=[Uicolor Graycolor]; [Self Base64]; }- (void) base64{//The string is encrypted, essentially BASE64 encoded.NSString *encodstr = [GTMBase64 encodebase64string:@"wanghaiteng504"]; NSLog (@"%@", ENCODSTR);/*encryption complete, print look, the effect of the encoding*/ //decryptionNSString *decodestr =[GTMBase64 Decodebase64string:encodstr]; NSLog (@"%@", DECODESTR); // // //Dictionary Encryption//nsdictionary *dic = [nsdictionary dictionarywithobjectsandkeys:@ "583267034", @ "Username", @ "wanghaiteng504", @ " Userpass ", nil];// //Convert dictionary to data//NSData *data = [nsjsonserialization datawithjsonobject:dic options:nsjsonwritingprettyprinted Error:nil];//NSData *encodedata = [GTMBase64 encodedata:data];//NSLog (@ "%@", encodedata);// // //decryption//NSData *decodedata = [GTMBase64 decodedata:encodedata];//nsdictionary *di = [nsjsonserialization jsonobjectwithdata:decodedata options:0 Error:nil];//NSLog (@ "%@", di); }@end
Some of the encryption Base64 iOS