Some of the encryption Base64 iOS

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.