MD5加密

作者: 狒狒James_Leo | 来源:发表于2017-10-23 14:26 被阅读0次
    #import "MD5Untils.h"
    #define MD5_LENGTH 16
    #import <CommonCrypto/CommonDigest.h>
    @implementation MD5Untils
    
    + (NSString *)MD5WithStr:(NSString *)originStr{
        
          const char *cString = [originStr UTF8String];
          unsigned char result[CC_MD5_DIGEST_LENGTH];
          CC_MD5(cString, (CC_LONG)originStr.length, result);
          NSMutableString *designStr = [NSMutableString string];
        
         for (int i = 0; i < CC_MD5_DIGEST_LENGTH; i++) {
            
            [designStr appendFormat:@"%02x", result[i]];
            
        }
        
             return designStr;
        
        
    }
    
    
    @end

    相关文章

      网友评论

          本文标题:MD5加密

          本文链接:https://www.haomeiwen.com/subject/qohauxtx.html