Discuz Password Generation

Source: Internet
Author: User
Tags md5 encryption

Discuz password encryption algorithm is actually two times MD5 encryption, first encrypted with plaintext, then randomly generate a salt, and then add a salt after the first cipher as plaintext and then once again MD5 encryption. The salt is saved in the Uc_members table and can be obtained by user name.

Like this:

MD5 (MD5 (Clear text) +salt)

The following is the implementation code for. NET:

copy code

string getdiscuzpwstring (string sourcestr, string salt)
{
     return Getmd5hash ( String. Concat (Getmd5hash (SOURCESTR), salt);
}

String Getmd5hash (String input)
{
    MD5 md5hasher = MD5. Create ();

    byte[] data = Md5hasher.computehash (Encoding.Default.GetBytes (input));

    StringBuilder sbuilder = new StringBuilder ();

    for (int i = 0; I < data. Length; i++)
    {
        sbuilder.append (Data[i]. ToString ("X2"));
   }

    return sbuilder.tostring ();
}

Summarize the method of password judgment
1: To install UC
2: Open the database Find uc_members This table, look for the last field "salt", copy the value inside
3:
$s =MD5 (MD5 ("password"). " The value of the Salt field ");
Echo $s;
4: Judging by If
5: Say it again! That's a random 6-digit number!

Discuz Password Generation

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.