php - Implement SHA 512 Hash with Code Igniter -
i have 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 libraries use $this->load->helper("form"); $this->load->helper("form_validation"); ///////////////////////////////////////////////////////////////// /////////////////////// new user validation ///////////////////// /////////////////////// format 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]'); } }
i wondered how can implement sha 512 hashing had before when doing app procedurally, exept time in codeigniter??
isset($_post['password']) $dynamsalt = mt_rand(20,100); $userpassword = hash('sha512',$dynamsalt.$userpassword);
does code igniter have built in function this??? or similar?
does code igniter have built in function this?
no, since php - don't need one.
hash('sha512', $string);
it can't easier or shorter that. why rewrite existing functionality?
however, hashing passwords in php suggest phpass:
Comments
Post a Comment