This means that the encrypted data is no longer:n8laahmftsaqgaf3+rufng==
Hope encryptedstring is "120387789370480938409832840923492384028934...";
Of course, the number above is my random knocking.
So how to achieve pure digital??
The idea is simple, just turn the character into a ASCLL code. For example a:97, =:61;
Then encryptedstring can become 97 81 61 33 44 55 ...;
But if it fits together, it becomes 978161334455.
Here's the question: How do I know 97 is a, not 9,7?
If you know that the computer is a binary representation, you should be able to think that we can turn 97 into 0, 1 forms.
Thus the above numbers can become 0001 0011 011 111 001.
OK, we also have 2,3,4,5,6,7,8,9, not used, so you can use any one of the characters to separate.
For example, change the number above to 0001 2 0011 2 011 2 111 2 001
Of course, there are numbers that can be encoded, but 3,4,5,6,7,8,9 are wasted.
So here we should not choose 2 binary, preferably should choose 9 binary. What's that?? 9 binary?
Yes, 9 binary: 0,1,2,3,4,5,6,7,8,10. Where 10 represents 9, then 9 as the separator symbol;
Unfortunately, the C # code does not support 9 binary, so it is convenient to choose 8 binary.
The code is as follows:
<summary>/// convert strings to numeric strings////</summary>// <param name= "value" > </param> //<returns></returns> string convertstringtonumbers (foreach ( int cascil = (return sb.) ToString (); }
String encryptednumberstring = Convertstringtonumbers (encryptedstring);
Encryptednumberstring =11697091549101914191109115910691649123
91019121914791419146963953912291259106915691479759759
Well, the separation has been successful, and the rest is to re-extract the characters from the string that makes up the numbers.
The code is as follows:
<summary>/// Convert a numeric string to a normal character string///</summary>// <param name= "value" ></param> //<returns></returns> string convertnumberstostring (value . Split (string. Join ("", Splitchars);}
The results are as follows:
asp.net,c# Pure Digital encryption and decryption string