Code Igniter가있는 SHA 512 해시를 구현합니다
-
11-12-2019 - |
문제
나는 Controller : 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]');
}
}
나는 내가 앱을 절차 적으로 수행 할 때 전에 내가 앱을 시도했을 때 샤 512 해싱을 구현할 수있는 방법을 궁금해했다.
.
isset($_POST['password'])
$dynamSalt = mt_rand(20,100);
$userPassword = hash('sha512',$dynamSalt.$userPassword);
코딩 점화기는이 기능을 내장하는 기능을 가지고 있습니까 ???또는 비슷한 것?
해결책
코딩 점화기는이 기능이 내장되어 있습니까?
아니오,하지만 PHP가 수행하기 때문에 - 당신은 필요하지 않습니다.
.hash('sha512', $string);
그보다 훨씬 쉽거나 짧을 수는 없습니다.왜 기존 기능을 다시 작성합니까?
그러나 PHP의 해싱 암호는 phaps : 를 제안합니다.