functions used to encrypt password in php?

后端 未结 3 753
我寻月下人不归
我寻月下人不归 2021-01-29 12:22

I am programming a PHP site that allows users to register,I\'m using codeigniter php and I want to know the best function to encrypt passwords and what difference between this f

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-29 13:10

    This is a custom encryption class which im using in codeigniter

    skey, $text, MCRYPT_MODE_ECB, $iv);
            return trim($this->safe_b64encode($crypttext)); 
        }
    
        public function decode($value){
    
            if(!$value){return false;}
            $crypttext = $this->safe_b64decode($value); 
            $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
            $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
            $decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $this->skey, $crypttext, MCRYPT_MODE_ECB, $iv);
            return trim($decrypttext);
        }
    }
    ?>
    

提交回复
热议问题