iOS code encryption commonly used encryption method, common iOS code encryption commonly used encryption algorithm includes MD5 encryption, AES encryption, BASE64 encryption, three algorithms iOS code encryption is how to encrypt, and see below &NBSP;MD5 iOS code encryption 1MD5 iOS code encryption creates the MD5 class with the following code #import <Foundation/Foundation.h> @interface cjmd5:nsobject+ (NSString *) Md5hexdigest: ( NSString *) input, @end2 #import "CJMD5.h" #import <CommonCrypto/CommonDigest.h> @implementation cjmd5+ (NSString * ) Md5hexdigest: (NSString *) input{ const char* str = [input utf8string]; unsigned char Resul t[cc_md5_digest_length]; CC_MD5 (str, strlen (str), result); nsmutablestring *ret = [ Nsmutablestring stringwithcapacity:cc_md5_digest_length]; for (int i = 0; i<cc_md5_digest_length ; i++) { [ret appendformat:@ "%02x",result]; } return ret;} @end3MD5 is irreversible only if encryption is not decrypted, iOS code encryption is used as follows nsstring *username = @ "Cerastes"; NSString *password = @ "Hello Word";// md5 encryption NSString *md5 = [CJMD5 Md5hexdigest:password]; NSLog (@ "%@", MD5); Endaes encrypted iOS code encryption 1AES encrypted iOS code encryptionHow to use// AES encryption NSString *encrypteddata = [Aescrypt encrypt:username password:password];//encryption NSString *message = [Aescrypt decrypt:encrypteddata Password:password]; Decryption NSLOG (@ "Encrypted result =%@", EncryptedData); NSLog (@ "Decryption result =%@", message); ENDBASE64 encrypt iOS code encryption 1base64 encrypt iOS code encryption add the following methods. H + (nsstring*) encodebase64string: (NSString *) input;+ (nsstring*) Decodebase64string: (NSString *) input;+ (nsstring*) Encodebase64data: (NSData *) data;+ (nsstring*) DecodeBase64Data: ( NSData *) data;2.m+ (nsstring*) encodebase64string: (NSString *) input { NSData *data = [input Datausingencodin g:nsutf8stringencoding allowlossyconversion:yes]; data = [GTMBase64 encodedata:data]; NSString *base64string = [[NSString alloc] Initwithdata:data encoding:nsutf8stringencoding]; return base64string;} + (nsstring*) decodebase64string: (NSString *) input { NSData *data = [input datausingencoding: Nsutf8stringencoding Allowlossyconversion:yes]; data = [GTMBase64 decodedata:data]; NSString *base64string = [[NSString all] OC] Initwithdata:data encoding:nsutf8stringencoding]; return base64string;} + (nsstring*) Encodebase64data: (NSData *) data { data = [GTMBase64 encodedata:data]; NSString *ba se64string = [[NSString alloc] initwithdata:data encoding:nsutf8stringencoding]; return base64string;} + (nsstring*) Decodebase64data: (NSData *) data { data = [GTMBase64 decodedata:data]; NSString *ba se64string = [[NSString alloc] initwithdata:data encoding:nsutf8stringencoding]; return base64string;} 3base64 encrypt iOS code encryption using methods// BASE64 encryption NSString *baseencodestring = [GTMBase64 encodebase64string: password]; NSString *basedecodestring = [GTMBase64 decodebase64string:baseencodestring]; NSLog (@ "baseencodestring =%@", baseencodestring); NSLog (@ "basedecodestring =%@ ", basedecodestring); Endios application code Encryption 1 In addition to the above three algorithms of iOS code encryption, iOS app code encryption is also very important, there is no code, the main iOS code encryption is as follows, iOS app code encryption is the Love encryption platform provides professional iOS encryption services. iOS code encryption common encryption method 21) Local data encryption to nsuserdefaults,sqlite storage file data encryption, protection of account numbers and key information. 2) URL encoding encryption to the URL that appears in the program encryption, to prevent the URL is static analysis 3) network data encryption to transmit data to the client to provide encryption scheme, effectively prevent the interception of network interface to obtain 4) method body, method name high-level confusion on the application's method name and method body to confuse, To ensure that the source code is reversed after it cannot be parsed 5) program structure mix-and-mix encryption to disrupt the application logical structure to ensure that the source readability is minimized
iOS code encryption common encryption method