Make WordPress Core


Ignore:
Timestamp:
05/31/2006 05:01:09 AM (20 years ago)
Author:
ryan
Message:

wp_hash(), wp_salt(), and server secret.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0/wp-includes/pluggable-functions.php

    r3780 r3813  
    489489
    490490    //Allow for expanding range, but only do one check if we can
    491     if( substr(md5($i . DB_PASSWORD . $action . $uid), -12, 10) == $nonce || substr(md5(($i - 1) . DB_PASSWORD . $action . $uid), -12, 10) == $nonce )
     491    if( substr(wp_hash($i . $action . $uid), -12, 10) == $nonce || substr(wp_hash(($i - 1) . $action . $uid), -12, 10) == $nonce )
    492492        return true;
    493493    return false;
     
    502502    $i = ceil(time() / 43200);
    503503   
    504     return substr(md5($i . DB_PASSWORD . $action . $uid), -12, 10);
     504    return substr(wp_hash($i . $action . $uid), -12, 10);
     505}
     506endif;
     507
     508if ( !function_exists('wp_salt') ) :
     509function wp_salt() {
     510    $salt = get_option('secret');
     511    if ( empty($salt) )
     512        $salt = DB_PASSWORD . DB_USER . DB_NAME . DB_HOST . ABSPATH;
     513
     514    return $salt;
     515}
     516endif;
     517
     518if ( !function_exists('wp_hash') ) :
     519function wp_hash($data) {
     520    $salt = wp_salt();
     521
     522    if ( function_exists('hash_hmac') ) {
     523        return hash_hmac('md5', $data, $salt);
     524    } else {
     525        return md5($data . $salt);
     526    }
    505527}
    506528endif;
Note: See TracChangeset for help on using the changeset viewer.