The examples in this article describe C # classes that obtain hash encryption to generate random security codes. Share to everyone for your reference. The specific analysis is as follows:
This C # class encapsulates a number of hash encryption features that can be used to get a random hash encrypted string to use very conveniently
Using system;using system.text;using system.security.cryptography;namespace dotnet.utilities{//<summary>// Get the Random security Code (hash encryption). </summary> public class Hashencode {public Hashencode () {////TODO: Add constructor logic here// }//<summary>//Get a random hash of the encrypted string///</summary>//<returns></returns> public Stati C String Getsecurity () {String Security = Hashencoding (Getrandomvalue ()); return Security; }///<summary>///Get a random value///</summary>//<returns></returns> public static S Tring Getrandomvalue () {Random Seed = new Random (); String randomvaule = Seed.next (1, Int. MaxValue). ToString (); return randomvaule; }//<summary>//hash encrypts a string, sharejs.com///</summary>//<param name= "Security" ></par am>//<returns></returns> public static string hashencoding (String Security) {byte[] Value; UnicodeEncoding Code = new UnicodeEncoding (); byte[] Message = code.getbytes (Security); sha512managed arithmetic = new sha512managed (); Value = Arithmetic.computehash (Message); Security = ""; foreach (Byte o in Value) {Security + = (int) o + "O"; } return Security; } }}
I hope this article is helpful to everyone's C # programming.
In addition to the Declaration,
Running GuestArticles are original, reproduced please link to the form of the address of this article
C # get hash encryption to generate class instances of random security codes
This address: http://www.paobuke.com/develop/c-develop/pbk23066.html
Related content C # internal keyword Summary C # dynamically load DLL files and implement a simple way to call them in C # a summary of the use of split usages in Visual C # for image processing (read, save, and access to pixels)
C # code implementation for AES encryption C # use Dispose mode to implement manual release of resources C # leverages the Win32 Api to modify the local system time, obtain the hard drive serial number C # implementation method of downloading the HTML source code of the Web page
C # get hash encryption to generate class instances of random security codes