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/cache.php

    r3797 r3813  
    6565    var $warm_cache_hits = 0;
    6666    var $cache_misses = 0;
     67    var $secret = '';
    6768
    6869    function acquire_lock() {
     
    143144        }
    144145
    145         $cache_file = $this->cache_dir.$this->get_group_dir($group)."/".md5($id.DB_PASSWORD).'.php';
     146        $cache_file = $this->cache_dir.$this->get_group_dir($group)."/".$this->hash($id).'.php';
    146147        if (!file_exists($cache_file)) {
    147148            $this->non_existant_objects[$group][$id] = true;
     
    172173
    173174        return "{$this->blog_id}/$group";
     175    }
     176
     177    function hash($data) {
     178        if ( function_exists('hash_hmac') ) {
     179            return hash_hmac('md5', $data, $this->secret);
     180        } else {
     181            return md5($data . $this->secret);
     182        }
    174183    }
    175184
     
    333342            $ids = array_unique($ids);
    334343            foreach ($ids as $id) {
    335                 $cache_file = $group_dir.md5($id.DB_PASSWORD).'.php';
     344                $cache_file = $group_dir.$this->hash($id).'.php';
    336345
    337346                // Remove the cache file if the key is not set.
     
    425434            $this->expiration_time = CACHE_EXPIRATION_TIME;
    426435
    427         $this->blog_id = md5($blog_id);
     436        if ( defined('WP_SECRET') )
     437            $this->secret = WP_SECRET;
     438        else
     439            $this->secret = DB_PASSWORD . DB_USER . DB_NAME . DB_HOST . ABSPATH;
     440
     441        $this->blog_id = $this->hash($blog_id);
    428442    }
    429443}
Note: See TracChangeset for help on using the changeset viewer.