Need to string encryption and decryption and encryption after the need to generate string to display in normal, no noise, recommended several kinds of commonly used, if you have the source code, so much the better, thank you!
CodePudding user response:
MD5 encryption
CodePudding user response:
reference 1st floor YBcsdn1996 response: MD5 encryption MD5 can only be used for signatures, and cannot be used for decryption CodePudding user response:
AES encryption required keys CodePudding user response:
Like BASE64 after TripleDES, encryption, and then the hexadecimal his good points CodePudding user response:
DES encryption/decryption Using System. Security. Cryptography. Private const string Key="custom Key"; //encryption Public static string DesEncrypt (string encryptString) { Byte [] keyBytes=Encoding. UTF8. GetBytes (Key. The Substring (0, 8)); Byte [] keyIV=keyBytes; Byte [] inputByteArray=Encoding. UTF8. GetBytes (encryptString); DESCryptoServiceProvider provider=new DESCryptoServiceProvider (); MemoryStream mStream=new MemoryStream (); CryptoStream cStream=new CryptoStream (mStream, provider. CreateEncryptor (keyBytes, keyIV), CryptoStreamMode. Write); CStream. Write (inputByteArray, 0, inputByteArray. Length); CStream. FlushFinalBlock (); Return the Convert. ToBase64String (mStream ToArray ()); } //decryption Public static string DesDecrypt (string decryptString) { Try { Byte [] keyBytes=Encoding. UTF8. GetBytes (Key. The Substring (0, 8)); Byte [] keyIV=keyBytes; Byte [] inputByteArray=the Convert. FromBase64String (decryptString); DESCryptoServiceProvider provider=new DESCryptoServiceProvider (); MemoryStream mStream=new MemoryStream (); CryptoStream cStream=new CryptoStream (mStream, provider. CreateDecryptor (keyBytes, keyIV), CryptoStreamMode. Write); CStream. Write (inputByteArray, 0, inputByteArray. Length); CStream. FlushFinalBlock (); Return. Encoding UTF8. Get string (mStream ToArray ()); } The catch (Exception ex) { return ""; } } CodePudding user response:
DES encryption/decryption CodePudding user response:
Then you this demand directly use base64 encoding not line? Or generate byte string [] also ok Or do you have any specific requirements? CodePudding user response:
refer to the original poster skyzj response: need to string encryption and decryption, and encryption after the need to generate string to display in normal, no noise, recommended several kinds of commonly used, if you have the source code, so much the better, thank you! AES - & gt; BASE64: encryption BASE64 - & gt; AES: decryption CodePudding user response:
Exclusive or ToBase64