PHP password-salt function

Views: 19 Last modified: August 03rd, 2011 Comments: 0

This function will return the passed password, extended with a salt in front and onto the end of the password. This function uses md5 for both the salts and sha256 for the password. It will return a 83 characters long string.

<?php

/**
 * PassSalt()
 * Will return a password using salt
 * Front Salt. Hashed Password . End Salt
 * Returns a string, 83 characters long
 * @param mixed $Fhash
 * @param mixed $Ehash
 * @param mixed $pass
 * @return string
 */
function PassSalt($FSalt, $ESalt, $pass)
{
    return sprintf('%s', substr(hash('md5', $FSalt), 0, 9).hash('sha256', trim($pass, ' ')).substr(hash('md5', $ESalt), 0, 10));
}
// Assign to a variable
$DB_PassWord = PassSalt('&*^jhu5i&$*^$%4', 'J5%*(#@jkd$bsajkh7', 'My_Secret_PassWord');

?>
VN:F [1.9.13_1145]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.13_1145]
Rating: 0 (from 0 votes)
    Bluehost

    Mail this!

    To: From:Sum {0+9} =  
    Anything to add ?

        You must be logged in to post a comment.