• 【代码笔记】iOS-3DES+Base64加密解密


    一,工程目录。

    二,代码。

    RootViewController.m

    复制代码
    #import "RootViewController.h"
    #import "NSString+TripleDES.h"
    #import "GTMBase64.h"
    
    @interface RootViewController ()
    
    @end
    
    @implementation RootViewController
    
    - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
    {
        self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
        if (self) {
            // Custom initialization
        }
        return self;
    }
    
    - (void)viewDidLoad
    {
        [super viewDidLoad];
        // Do any additional setup after loading the view.
        
        self.title=@"3DES+Base64";
        
        
        //要加密的文字和密码
       NSString *string=@"hello,World";
       NSString *key=@"123456";
       
        
        //加密
        NSString *encryString=[NSString stringWithFormat:@"%@",[string EncryptTripleDESWithKey:key]];
        NSLog(@"---string--%@",encryString);
        //解密
        NSString *decryString=[NSString stringWithFormat:@"%@",[encryString DecryptTripleDESWithKey:key]];
        NSLog(@"--string--%@",decryString);
        
    }
    - (void)didReceiveMemoryWarning
    {
        [super didReceiveMemoryWarning];
        // Dispose of any resources that can be recreated.
    }
    复制代码

     

    三,运行效果

    2015-10-13 10:29:59.107 3DES+Base64加密解密[2277:66277] ---string--YDcteAUNvtE0PoB6hZpsKg==
    2015-10-13 10:29:59.108 3DES+Base64加密解密[2277:66277] --string--hello,World

     

  • 相关阅读:
    Kafka架构概述
    Logstash使用进阶篇
    Logstash使用快速入门
    Ubuntu环境部署Logstash实战案例
    Nginx代理Kibana并实现登录认证实战案例
    Ubuntu环境部署Kibana实战案例
    Idea打包JAR包图解
    Wormhole部署实战案例
    编译Wormhole实战篇
    Wormhole的核心概念
  • 原文地址:https://www.cnblogs.com/yang-guang-girl/p/5006224.html
Copyright © 2020-2023  润新知