Welcome Guest, Not a member yet? Register   Sign In
md5 to sha1
#12

[eluser]BrianDHall[/eluser]
You're close:

Code:
function create_member()
    {
        $static_salt = 'YYYY';
        $new_member_insert_data = array(
            'first_name' => $this->input->post('first_name'),
            'last_name' => $this->input->post('last_name'),
            'email_address' => $this->input->post('email_address'),            
            'username' => $this->input->post('username'),
            'password' => md5($this->input->post('password') . $static_salt)                        
        );
        
        $insert = $this->db->insert('membership', $new_member_insert_data);
        return $insert;
    }

You should add the salt before hashing - meaning that it will still end up the same amount of characters in length after hasing. As to config file, you can checkout the config class: http://ellislab.com/codeigniter/user-gui...onfig.html

Personally, I prefer to just do something a bit more dirty - like pop open config.php and put in a constant declaration for something like _SALT_. Yeah, it makes it available everywhere, but what's 1 extra constant among friends?

Note the difference in 30 and 60 characters, unless you have a stunningly large site, is immaterial to such decisions - I'd recommend you just make it the 60 long and use sha1(), with the static salt addition before hashing being just fine.


Messages In This Thread
md5 to sha1 - by El Forum - 10-19-2009, 11:24 AM
md5 to sha1 - by El Forum - 10-19-2009, 12:14 PM
md5 to sha1 - by El Forum - 10-19-2009, 12:17 PM
md5 to sha1 - by El Forum - 10-19-2009, 12:28 PM
md5 to sha1 - by El Forum - 10-19-2009, 12:42 PM
md5 to sha1 - by El Forum - 10-19-2009, 12:47 PM
md5 to sha1 - by El Forum - 10-19-2009, 03:07 PM
md5 to sha1 - by El Forum - 10-20-2009, 12:13 PM
md5 to sha1 - by El Forum - 10-21-2009, 01:07 AM
md5 to sha1 - by El Forum - 10-21-2009, 02:24 AM
md5 to sha1 - by El Forum - 10-21-2009, 11:11 AM
md5 to sha1 - by El Forum - 10-21-2009, 12:13 PM
md5 to sha1 - by El Forum - 10-22-2009, 11:36 AM
md5 to sha1 - by El Forum - 10-22-2009, 04:02 PM



Theme © iAndrew 2016 - Forum software by © MyBB