Small white C # form Series-09. SHA Series Encryption

Source: Internet
Author: User
Tags image converter sha1

SHA series encryption, SHA512 security is safe, but the number of bits is too long, very few people use it to encrypt the password, below I briefly introduce SHA and some variant encryption (SHA512 will also use)   program with internationalization, are used UTF-8 encoding format   (if there are more than I have to write the same encryption method to get the ciphertext different, if you want to question, first put the code to see, different codes produce ciphertext is different)   provide another way of thinking (next stage): In the process of multiple encryption code repeatedly change ... Think about it. ~  This is SHA-1 encryption, and MD5 the same   maybe someone will ask, that for loop why not? I'm using the officially provided method, for loop that generally only in the internal byte deformation or just learn to use   If you do not know what I said,,,, look at this diary, there is an explanation: http://user.qzone.qq.com/ 1054186320/blog/1407540646 This is the current edition of practiced hand software:http://pan.baidu.com/s/1sjjwqpz     public  String getshaone (string input)//sha-1 encryption {    //Gen     SHA1  shaone = sha1. Create ();      //Change     byte[] shaOneBuffer =  Shaone.computehash (Encoding.UTF8.GetBytes (input));      //Guan      Shaone.clear ();      return bitconverter.tostring (ShaOneBuffer). Replace ("-",  ""). ToLower ();///Another simple method}    that SHA256 how to use it? Easy, change SHA1 to SHA25.6 on the line, the code is as follows:  public string getshax (string input) {    //     sha256 shax = sha256. Create ();      //Change     byte[] shaXBuffer =  Shax.computehash (Encoding.UTF8.GetBytes (input));      //Guan      Shax.clear ();      return bitconverter.tostring (Shaxbuffer). Replace ("-",  ""). ToLower ();///Another simple method}  well, the following highlights my latest encryption results: DNTDBT encryption (dnt big pervert)   In fact, it is not my own creation of encryption, is the usual encryption of my own "humanization" plus their own ideas, A little change, and then re-cast the   can also be called: SHA series of comprehensive variation "with the SHA512 (currently the most secure encryption)" ~ Encoding format for utf-8  first talk about the idea: Clear text-->sha512-->base64-- >btmd5-->bysha-->sha512-->base64-->bysha (40 bit) "This is called encryption order or some mystery, the specific self-speculation oh ~"   Recommend the webmaster with this most complex encryption method to enter the password ~ I put the code in a simple optimization, you can re-optimize (optimize the angle: from saving resources to start)   My side is mainly to small white to see can not optimize, otherwise they must not understand   code paste:  public  STRING DNTDBT (string input) {    //Gen     sha512  shax = sha512. Create ();      //change + off     string newinput = getbysha ( GetBTMD5 (GetBase64 (Shax.computehash (Encoding.UTF8.GetBytes (input))));             string strshax = getbase64 (ShaX.ComputeHash ( Encoding.UTF8.GetBytes (newinput));             Shax.clear ();//Release the resources of a series of encryption             return  getbysha (Strshax);}   Does it feel simple? Cough, the following is the real massive code, above is just a method to call multiple methods only ~~  //MD5 small mutation public string getsxmd5 (string input) {     //Chong     md5 md5 = md5. Create ();      //turn     byte[] md5buffer = md5. ComputeHash (Encoding.UTF8.GetBytes (input));     stringbuilder sbmd5 =  New stRingbuilder ();        for  (Int i = md5buffer. length - 1; i >= 0; i--)     {         sbmd5.append (Md5buffer[i]. ToString ("X2"));     }     //off     md5. Clear ();      return sbmd5.tostring ();}  //sha-1 encryption Public string getshaone (string input) {    //Gen      sha1 shaone = sha1. Create ();      //Change     byte[] shaOneBuffer =  Shaone.computehash (Encoding.UTF8.GetBytes (input));      //Guan      Shaone.clear ();      return bitconverter.tostring (ShaOneBuffer). Replace ("-",  ""). ToLower ();///Another simple method (can also be done with the above traversal)} //MD5 mutation--a process to become MD5 (guaranteed number of digits) public string  GetBTMD5 (string input) {    //Gen     md5 md5 = md5. Create ();      //becomes     byte[] md5buffer = md5. ComputeHash (Encoding.UTF8.GetBytes (input));      ////mutation Start      Stringbuilder sb = new stringbuilder ();         for   (int i = md5buffer.length - 1; i >= 0; i--)      {        SB. Append (((int). Parse (Md5buffer[i]. ToString ())) ( - 1). ToString ("X2"));     }     //off     md5. Clear ();      //re-reinforcing     RETURN GETSXMD5 (sb.) ToString ());}  //base64 encryption (The reason why he was chosen because his address has a variety of special symbols, multiple crack very difficult) public string getbase64 (Byte[] inputbuffer) {     reTurn convert.tobase64string (InputBuffer);}  //sha-1 Small Variant Public string getbysha (string input) {    //Chong      sha1 shaone = sha1. Create ();      //Change     byte[] shaOneBuffer =  Shaone.computehash (Encoding.UTF8.GetBytes (input));      string newinput =  getbase64 (Shaonebuffer);     byte[] shanewbuffer =  Shaone.computehash (Encoding.UTF8.GetBytes (Newinput));      //Guan      Shaone.clear ();      return bitconverter.tostring (ShaNewBuffer). Replace ("-",  ""). ToLower ();}   Cough, see this shows that you have not been frightened, or that you directly a look thousand line, OK, inverse days have a habit, speak a technical point like hair a big trick, I also made a software for you reference   source code as follows: http://pan.baidu.com/s/ 1c0o03qs  If you Base64 not understand the encryption, read this article:http://user.qzone.qq.com/1054186320/blog/1409210604  if you MD5 series still do not understand , just read this article: http://user.qzone.qq.com/1054186320/blog/1407540646 If you don't like the icon layout, look at this article: http://user.qzone.qq.com/1054186320/blog/1396659636
If you're still a little bit of that in C #, I'll send you some resources: http://user.qzone.qq.com/1054186320/blog/1404357056Faint drift over ~ next time will get a more complex encryption ~ First Flash ~ ~ ~


This issue recommendation: Codesmith Generator 7.0.2 next issue: to create a universal image Converter

Small white C # form Series-09. SHA Series Encryption

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.