如果專案中涉及到登陸註冊等。
此時就需要考慮密碼的加密
ios下的具體實現方式如下
新建乙個類 繼承
[objc]view plain
copy
#import
#import
@inte***cemd5
: nsobject
/*** md5加密,傳入需要加密的字串,不可逆
** @param str 需要加密的字串
** @return 加密後字串
*/+ (nsstring
*)md5:(
nsstring
*)str;
@end
類的實現
[objc]view plain
copy
#import "md5.h"
@implementationmd5
+ (nsstring
*)md5:(
nsstring
*)str
@end
具體使用
[objc]view plain
copy
nsstring
*str=
@"準備加密"
; nsstring
*str
1=[md
5md5
:str];
nslog(@"str=%@,str1=%@"
,str,str
1);
輸出結果
tes***5[659:20205] str=準備加密,str1=54a96da37e422e51
我在網上找乙個加密工具測試一下
好了 基本可以使用了
有什麼問題 可以加qq聊
蘋果開發群 :414319235 歡迎加入
IOS MD5加密方法
方法一 import inte ce nsstring md5 nsstring md5hexdigest end import nsstring md5hexdigest.h implementation nsstring md5 nsstring md5hexdigest end 方法二 將字串...
IOS MD5加密方法
方法一 import inte ce nsstring md5 nsstring md5hexdigest end import nsstring md5hexdigest.h implementation nsstring md5 nsstring md5hexdigest end 方法二 將字串...
iOS MD5加密與網路資料安全
在做網路應用程式的時候 時時刻刻要保證使用者資料的安全 因此要加密。md5演算法在國內用的很多.md5演算法的特點 同樣的資料 加密結果是一樣的.32個字元 不可逆的 不能逆向解密 可用於檔案校驗 指紋識別.md5演算法是公開的,ios中已經包裝好了md5演算法。可以將其寫成字串的分類 objc v...