Changeset 3811

Show
Ignore:
Timestamp:
05/31/06 01:40:00 (3 years ago)
Author:
ryan
Message:

wp_salt() and more hash work.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/cache.php

    r3810 r3811  
    6565    var $warm_cache_hits = 0; 
    6666    var $cache_misses = 0; 
     67    var $secret = ''; 
    6768 
    6869    function acquire_lock() { 
     
    175176 
    176177    function hash($data) { 
    177         global $wp_server_secret; 
    178         if ( empty($wp_server_secret) ) 
    179             $wp_server_secret = DB_PASSWORD; 
    180  
    181178        if ( function_exists('hash_hmac') ) { 
    182             return hash_hmac('md5', $data, $wp_server_secret); 
     179            return hash_hmac('md5', $data, $this->secret); 
    183180        } else { 
    184             return md5($data . $wp_server_secret); 
     181            return md5($data . $this->secret); 
    185182        } 
    186183    } 
     
    398395 
    399396    function WP_Object_Cache() { 
    400         global $blog_id
     397        global $blog_id, $wpdb
    401398 
    402399        if (defined('DISABLE_CACHE')) 
     
    427424            $this->expiration_time = CACHE_EXPIRATION_TIME; 
    428425 
     426        if ( defined('WP_SECRET') ) 
     427            $this->secret = WP_SECRET; 
     428        else 
     429            $this->secret = DB_PASSWORD . DB_USER . DB_NAME . DB_HOST . ABSPATH; 
     430 
    429431        $this->blog_id = $this->hash($blog_id); 
    430432    } 
  • trunk/wp-includes/pluggable-functions.php

    r3810 r3811  
    509509endif; 
    510510 
     511if ( !function_exists('wp_salt') ) : 
     512function wp_salt() { 
     513    $salt = get_option('secret'); 
     514    if ( empty($salt) ) 
     515        $salt = DB_PASSWORD . DB_USER . DB_NAME . DB_HOST . ABSPATH; 
     516 
     517    return $salt; 
     518} 
     519endif; 
     520 
    511521if ( !function_exists('wp_hash') ) : 
    512522function wp_hash($data) { 
    513     $secret = get_option('secret'); 
    514     if ( empty($secret) ) 
    515         $secret = DB_PASSWORD; 
     523    $salt = wp_salt(); 
    516524 
    517525    if ( function_exists('hash_hmac') ) { 
    518         return hash_hmac('md5', $data, $secret); 
     526        return hash_hmac('md5', $data, $salt); 
    519527    } else { 
    520         return md5($data . $secret); 
     528        return md5($data . $salt); 
    521529    } 
    522530}