Cod*_*alk 2 php codeigniter sha512
我有一个控制器:landingpage.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class LandingPage extends CI_Controller {
public function index(){
$data = array(
'head' => $this->load->view('Landing_Header', '', true),
'guts' => $this->load->view('Landing_Guts', '', true),
'foot' => $this->load->view('Landing_Footer', '', true)
);
$this->load->view('index', $data);
}
public function validateInput(){
#load help libraries for use
$this->load->helper("form");
$this->load->helper("form_validation");
/////////////////////////////////////////////////////////////////
/////////////////////// New User Validation /////////////////////
/////////////////////// Format for Validation : ////////////////
////////// "field name","Error Value","validation method" ///////
$this->form_validation->set_rules('fullname','Your Name','required|min_length[2]|max_length[20]');
$this->form_validation->set_rules('email','Your Email','required|valid_email|is_unique[users.email]');
$this->form_validation->set_rules('emailConf','Email Confirm','required|matches[email]');
$this->form_validation->set_rules('password','Password','required|min_length[2]|max_length[20]');
}
}
Run Code Online (Sandbox Code Playgroud)
我想知道如何实现SHA 512散列,就像我以前在程序上执行我的应用程序时一样,这次在CODEIGNITER中执行?
isset($_POST['password'])
$dynamSalt = mt_rand(20,100);
$userPassword = hash('sha512',$dynamSalt.$userPassword);
Run Code Online (Sandbox Code Playgroud)
代码点火器是否具有内置功能?或类似的东西?
代码点火器是否具有内置功能?
不,但是因为PHP确实 - 你不需要一个.
hash('sha512', $string);
Run Code Online (Sandbox Code Playgroud)
它不会比这更简单或更短.为什么重写现有功能?
但是,对于PHP中的哈希密码,我建议使用phpass:
http://www.openwall.com/phpass/
归档时间: |
|
查看次数: |
3835 次 |
最近记录: |