iphone 加密汇总
来源:互联网 发布:织梦网站数据采集器 编辑:程序博客网 时间:2024/05/02 12:32
MD5
- (NSString *)createMD5:(NSString *)signString
{
constchar*cStr =[signStringUTF8String];
unsignedchar result[16];
CC_MD5(cStr,strlen(cStr), result);
return[NSStringstringWithFormat:
@"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
result[0], result[1], result[2], result[3],
result[4], result[5], result[6], result[7],
result[8], result[9], result[10], result[11],
result[12], result[13], result[14], result[15]
];
}
- (NSString*)createRC4:(NSString*)aInput key:(NSString*)aKey
{
NSMutableArray *iS = [[NSMutableArrayalloc]initWithCapacity:256];
NSMutableArray *iK = [[NSMutableArrayalloc]initWithCapacity:256];
for (int i=0; i<256; i++) {
[iS addObject:[NSNumbernumberWithInt:i]];
}
int j=1;
for (short i=0; i<256; i++) {
UniChar c = [aKeycharacterAtIndex:i%aKey.length];
[iK addObject:[NSNumbernumberWithChar:c]];
}
j=0;
for (int i=0; i<255; i++) {
int is = [[iSobjectAtIndex:i]intValue];
UniChar ik = (UniChar)[[iKobjectAtIndex:i]charValue];
j = (j + is + ik)%256;
NSNumber *temp = [iSobjectAtIndex:i];
[iS replaceObjectAtIndex:iwithObject:[iSobjectAtIndex:j]];
[iS replaceObjectAtIndex:jwithObject:temp];
}
int i=0;
j=0;
NSString *result = aInput;
for (short x=0; x<[aInputlength]; x++) {
i = (i+1)%256;
int is = [[iSobjectAtIndex:i]intValue];
j = (j+is)%256;
int is_i = [[iSobjectAtIndex:i]intValue];
int is_j = [[iSobjectAtIndex:j]intValue];
int t = (is_i+is_j) %256;
int iY = [[iSobjectAtIndex:t]intValue];
UniChar ch = (UniChar)[aInputcharacterAtIndex:x];
UniChar ch_y = ch^iY;
result = [resultstringByReplacingCharactersInRange:NSMakeRange(x,1)withString:[NSStringstringWithCharacters:&ch_ylength:1]];
}
[iS release];
[iK release];
return result;
}
- iphone 加密汇总
- MD5加密 iphone
- iphone AES加密
- iphone MD5加密
- iphone程序加密处理
- iphone开源汇总
- iphone开源汇总
- iphone开发资源汇总
- iphone开发资源汇总
- iphone开发资源汇总
- IPhone开发资源汇总
- iphone开发资源汇总
- iPhone开发资源汇总
- iPhone开发资源汇总
- iphone开发资源汇总
- iPhone开发资料汇总
- iPhone开发资源汇总
- iphone开发资源汇总
- sharepoint2007标准版和企业版的区别
- xml--android--SAX快速上手
- html5设计原理
- 由Release版程序崩溃地址逆推崩溃代码行
- android 之对话框的使用
- iphone 加密汇总
- 使用Spring Security3的四种方法概述
- 时间正则表达式
- Java 对象引用:强引用、软引用、弱引用和虚引用
- Ubuntu安装配置MPI环境
- 中文字符集
- Dear 我要开博了
- 收集项
- 无限制免费版,完美您的WEB应用--PAZU在线打印