You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
942 B
Plaintext
33 lines
942 B
Plaintext
9 years ago
|
<?php /* -*- php -*- */
|
||
|
|
||
|
function _fulcrm_uuid_stir_entropy() {
|
||
|
$entropy = '';
|
||
|
|
||
|
$entropy .= mt_rand();
|
||
|
$entropy .= rand();
|
||
|
|
||
|
$entropy .= time();
|
||
|
if ( function_exists( 'microtime' ) )
|
||
|
$entropy .= microtime();
|
||
|
|
||
|
$entropy .= variable_get( 'cron_key', '' );
|
||
|
$entropy .= variable_get( 'cron_last', '' );
|
||
|
$entropy .= variable_get( 'drupal_private_key', '' );
|
||
|
$entropy .= variable_get( 'site_name', '' );
|
||
|
|
||
|
if ( function_exists( 'openssl_random_pseudo_bytes' ) )
|
||
|
$entropy .= openssl_random_pseudo_bytes( 32 );
|
||
|
|
||
|
$handle = fopen( '/dev/urandom', 'r' );
|
||
|
$entropy .= fread( $handle, 32 );
|
||
|
fclose( $handle );
|
||
|
|
||
|
$old_entropy = variable_get( 'fulcrm_uuid_entropy_1', '' ) . variable_get( 'fulcrm_uuid_entropy_2', '' );
|
||
|
variable_set( 'fulcrm_uuid_entropy_1', sha1( $entropy ) );
|
||
|
variable_set( 'fulcrm_uuid_entropy_2', md5( $old_entropy . $entropy ) );
|
||
|
}
|
||
|
|
||
|
function fulcrm_uuid_install() {
|
||
|
_fulcrm_uuid_stir_entropy();
|
||
|
}
|