博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
iOS之 那几种加密 Base64
阅读量:4684 次
发布时间:2019-06-09

本文共 1345 字,大约阅读时间需要 4 分钟。

 

 哈哈哈哈?  -------------  大哥原创

 请多多指教 .....................................................


 

ViewController.m
////  ViewController.m//  Base64////  Created by dllo on 16/1/12.//  Copyright © 2016年 HaiTeng. All rights reserved.//#import "ViewController.h"#import "GTMBase64.h"@interface ViewController ()@end@implementation ViewController- (void)viewDidLoad {    [super viewDidLoad];    self.view.backgroundColor = [UIColor grayColor];        [self Base64];    }- (void)Base64{    //对字符串进行加密,实质上是进行BASE64编码.    NSString *encodStr = [GTMBase64 encodeBase64String:@"wanghaiteng504"];    NSLog(@"%@",encodStr); /*加密完毕,打印看看,编码后的效果*/        //解密    NSString *decodeStr = [GTMBase64 decodeBase64String:encodStr];    NSLog(@"%@",decodeStr);    //    //    //字典加密//    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:@"583267034",@"Username",@"wanghaiteng504",@"Userpass", nil];//    //字典转化为Data//    NSData *data = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:nil];//    NSData *encodeData = [GTMBase64 encodeData:data];//    NSLog(@"%@",encodeData);//    //    //解密//    NSData *decodeData = [GTMBase64 decodeData:encodeData];//    NSDictionary *di = [NSJSONSerialization JSONObjectWithData:decodeData options:0 error:nil];//    NSLog(@"%@",di);    }@end

 

转载于:https://www.cnblogs.com/HaiTeng/p/5324118.html

你可能感兴趣的文章
Struts2 Action名称的搜索顺序
查看>>
C++ sort简单用法
查看>>
Oracle分区索引
查看>>
4.17上午
查看>>
IIS的ISAPI接口简介
查看>>
python:open/文件操作
查看>>
16 乘法口诀输出
查看>>
mac 常用地址
查看>>
鼠标经过切换图片
查看>>
流程控制 Day06
查看>>
Linux下安装Tomcat
查看>>
windows live writer 2012 0x80070643
查看>>
C程序的启动和终止
查看>>
asp.net web 定时执行任务
查看>>
tomcat 和MySQL的安装
查看>>
11.5 内部类
查看>>
Cosine Similarity
查看>>
浅谈JAVA集合框架
查看>>
halt和shutdown 的区别
查看>>
git常用操作
查看>>