Home  >  Article  >  Backend Development  >  A brief discussion on discuz password encryption method_PHP tutorial

A brief discussion on discuz password encryption method_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:29:32894browse

When discuz registers, the password will be encrypted according to a rule.

For example, my password is 123456

Copy code The code is as follows:

echo md5("123456");

will output:

Copy code The code is as follows:

e10adc3949ba59abbe56e057f20f883e

The value in the database is:

Copy code The code is as follows:

7839dc9437013b5c11a5d86e9b8350e9

NOTE:

There is a field called salt, its value is: d82a35

Actually this is a random string.

The value after the first md5 plus the salt value (salt) and then md5 is the value to be obtained.

Try it

Copy code The code is as follows:

echo md5(md5('123456').'d82a35');

This time the result is: 7839dc9437013b5c11a5d86e9b8350e9, which is correct.

In versions prior to php5.5, there was no good encryption mechanism. This is a good way to go. Password security has been greatly enhanced.

There is a more reliable and convenient encryption method in php5.5. Friends who like to delve deeper can find out:

password_hash()

http://www.php.net/manual/zh/function.password-hash.php

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/774995.htmlTechArticleWhen discuz registers, the password will be encrypted according to a rule. For example, my password is 123456. Copy code. The code is as follows: echo md5("123456"); will output: Copy code. The code is as follows: e10adc3949...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn