C # get hash encryption to generate class instances of random security codes

Source: Internet
Author: User
Tags random seed

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.