资源简介
内附rsa双向加密完整代码,适合iOS开发初中级开发人员。
代码片段和文件信息
//
// base64.m
//
// Version 1.1
//
// Created by Nick Lockwood on 12/01/2012.
// Copyright (C) 2012 Charcoal Design
//
// Distributed under the permissive zlib License
// Get the latest version from here:
//
// https://github.com/nicklockwood/base64
//
// This software is provided ‘as-is‘ without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose
// including commercial applications and to alter it and redistribute it
// freely subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such and must not be
// misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
#import “base64.h“
#import
#if !__has_feature(objc_arc)
#error This library requires automatic reference counting
#endif
@implementation NSData (base64)
+ (NSData *)dataWithbase64EncodedString:(NSString *)string
{
const char lookup[] =
{
99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99
99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99
99 99 99 99 99 99 99 99 99 99 99 62 99 99 99 63
52 53 54 55 56 57 58 59 60 61 99 99 99 99 99 99
99 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
15 16 17 18 19 20 21 22 23 24 25 99 99 99 99 99
99 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50 51 99 99 99 99 99
};
NSData *inputData = [string dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
long long inputLength = [inputData length];
const unsigned char *inputBytes = [inputData bytes];
long long maxOutputLength = (inputLength / 4 + 1) * 3;
NSMutableData *outputData = [NSMutableData dataWithLength:maxOutputLength];
unsigned char *outputBytes = (unsigned char *)[outputData mutableBytes];
int accumulator = 0;
long long outputLength = 0;
unsigned char accumulated[] = {0 0 0 0};
for (long long i = 0; i < inputLength; i++)
{
unsigned char decoded = lookup[inputBytes[i] & 0x7F];
if (decoded != 99)
{
accumulated[accumulator] = decoded;
if (accumulator == 3)
{
outputBytes[outputLength++] = (accumulated[0] << 2) | (accumulated[1] >> 4);
outputBytes[outputLength++] = (accumulated[1] << 4) | (accumulated[2] >> 2);
outputBytes[output
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2014-02-27 15:14 IOS-RSA\
文件 6148 2014-02-27 15:14 IOS-RSA\.DS_Store
目录 0 2014-02-28 13:47 __MACOSX\
目录 0 2014-02-28 13:47 __MACOSX\IOS-RSA\
文件 120 2014-02-27 15:14 __MACOSX\IOS-RSA\._.DS_Store
目录 0 2014-02-27 15:10 IOS-RSA\ba
文件 1641 2013-06-05 14:08 IOS-RSA\ba
目录 0 2014-02-28 13:47 __MACOSX\IOS-RSA\ba
文件 212 2013-06-05 14:08 __MACOSX\IOS-RSA\ba
文件 7010 2013-06-05 14:08 IOS-RSA\ba
文件 212 2013-06-05 14:08 __MACOSX\IOS-RSA\ba
目录 0 2014-02-27 15:14 IOS-RSA\RSA\
文件 6148 2014-02-27 15:14 IOS-RSA\RSA\.DS_Store
目录 0 2014-02-28 13:47 __MACOSX\IOS-RSA\RSA\
文件 120 2014-02-27 15:14 __MACOSX\IOS-RSA\RSA\._.DS_Store
文件 706 2013-06-14 11:50 IOS-RSA\RSA\CRSA.h
文件 212 2013-06-14 11:50 __MACOSX\IOS-RSA\RSA\._CRSA.h
文件 3548 2013-06-14 11:50 IOS-RSA\RSA\CRSA.m
文件 212 2013-06-14 11:50 __MACOSX\IOS-RSA\RSA\._CRSA.m
目录 0 2013-06-14 11:50 IOS-RSA\RSA\include\
文件 6279 2013-06-05 14:08 IOS-RSA\RSA\include\LICENSE
目录 0 2014-02-28 13:47 __MACOSX\IOS-RSA\RSA\include\
文件 212 2013-06-05 14:08 __MACOSX\IOS-RSA\RSA\include\._LICENSE
目录 0 2013-06-14 11:50 IOS-RSA\RSA\include\openssl\
文件 5507 2013-06-05 14:08 IOS-RSA\RSA\include\openssl\aes.h
目录 0 2014-02-28 13:47 __MACOSX\IOS-RSA\RSA\include\openssl\
文件 212 2013-06-05 14:08 __MACOSX\IOS-RSA\RSA\include\openssl\._aes.h
文件 52190 2013-06-05 14:08 IOS-RSA\RSA\include\openssl\asn1.h
文件 212 2013-06-05 14:08 __MACOSX\IOS-RSA\RSA\include\openssl\._asn1.h
文件 19143 2013-06-05 14:08 IOS-RSA\RSA\include\openssl\asn1_mac.h
文件 212 2013-06-05 14:08 __MACOSX\IOS-RSA\RSA\include\openssl\._asn1_mac.h
............此处省略155个文件信息
相关资源
- PGP Command Line 使用教程
- BoostIos库
- RCC.71-v2.4.pdf RCS Universal Profile Service
- Y470_Y570 2.10 bios 64位
- 联想Q57主板BIOS
- 技嘉 B85M-DS3H-A
- 苹果手机计算器
- unity for ios 上传IOS机本地的头像 相机
- STM32AES加密程序.zip
- BIOSU80GT2g+32g).rar
- SmartAssembly v6.9.0.114 最新混淆 你懂大家
- CISCO2950最新IOS映像:c2950-i6k2l2q4-mz.1
- pnp4nagios-0.6.25.tar.gz
- 前台加密后台解密-非对称RSA加密方式
- Markman标注工具破解版
- ios+dome+仿微信+主界面+部分代码
- 好用的移动硬盘/U盘加密软件
- dell n5110 bios
- 联想 lenovo 主板 945GZT-LM G31T-LM BIOS C
- SWIFTER-100个Swift必备Tips(第二版)
- Arnold变换 Logistic映射进行图像加密处
- EXE视频加密器4.0完美破解破解版可自
- Functional Reactive Programming on iOS.pdf
- 加密视频破解.doc
- 传智播客IOS视频源码
- AMI VeB whitepaper
- RSA公钥密码算法的能量分析攻击与防
- 基于置乱加密的小波域数字图像水印
- 共享文件夹加密专家 v4.5.0 破解版
- 斯坦福大学公开课:iOS 7应用开发 中
评论
共有 条评论