Make WordPress Core


Ignore:
Timestamp:
05/31/2006 12:24:03 AM (20 years ago)
Author:
ryan
Message:

wp_hash() and server secret.

File:
1 edited

Legend:

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

    r3783 r3810  
    492492
    493493    //Allow for expanding range, but only do one check if we can
    494     if( substr(md5($i . DB_PASSWORD . $action . $uid), -12, 10) == $nonce || substr(md5(($i - 1) . DB_PASSWORD . $action . $uid), -12, 10) == $nonce )
     494    if( substr(wp_hash($i . $action . $uid), -12, 10) == $nonce || substr(wp_hash(($i - 1) . $action . $uid), -12, 10) == $nonce )
    495495        return true;
    496496    return false;
     
    505505    $i = ceil(time() / 43200);
    506506   
    507     return substr(md5($i . DB_PASSWORD . $action . $uid), -12, 10);
     507    return substr(wp_hash($i . $action . $uid), -12, 10);
     508}
     509endif;
     510
     511if ( !function_exists('wp_hash') ) :
     512function wp_hash($data) {
     513    $secret = get_option('secret');
     514    if ( empty($secret) )
     515        $secret = DB_PASSWORD;
     516
     517    if ( function_exists('hash_hmac') ) {
     518        return hash_hmac('md5', $data, $secret);
     519    } else {
     520        return md5($data . $secret);
     521    }
    508522}
    509523endif;
Note: See TracChangeset for help on using the changeset viewer.