Home >类库下载 >PHP类库 >Non-reverse parameter md5 encryption method

Non-reverse parameter md5 encryption method

高洛峰
高洛峰Original
2016-10-21 10:23:071381browse

/*
* 如只传进一个$pass参数,则表示加密,并返回一数组
* 数组包含一个加密常量和加密后的密文,如:
* array('pass'=>$pass,'encrypt'=>$encrypt);
* 传进两个参数则返回密文
*/
function password($pass,$encrypt=''){
    if(empty($encrypt)){
        $code = rand(100000, 999999);
        $password = array(
            'password'    => password(trim($pass),$code),
             'encrypt' => $code,
        );
    }else{
        $password = md5(md5($pass).$encrypt);
    }
    return $password;
}

The above method is written to prevent some md5 encryption from being too simple and easily cracked

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

Related articles

See more