Renaming Configure var 'Security.cipher_seed' to 'Security.cipherSeed'. Also added a srand() call at end of Security::cipher function to reset seed. Closes #73 , #183 , #218

This commit is contained in:
ADmad 2010-01-20 01:23:20 +05:30
parent 39dd15d3f6
commit 22073e3376
4 changed files with 7 additions and 5 deletions

View file

@ -200,7 +200,7 @@
/** /**
* A random numeric string (digits only) used to encrypt/decrypt strings. * A random numeric string (digits only) used to encrypt/decrypt strings.
*/ */
Configure::write('Security.cipher_seed', '76859309657453542496749683645'); Configure::write('Security.cipherSeed', '76859309657453542496749683645');
/** /**
* Apply timestamps with the last modified time to static assets (js, css, images). * Apply timestamps with the last modified time to static assets (js, css, images).

View file

@ -209,7 +209,7 @@
/** /**
* A random numeric string (digits only) used to encrypt/decrypt strings. * A random numeric string (digits only) used to encrypt/decrypt strings.
*/ */
Configure::write('Security.cipher_seed', '76859309657453542496749683645'); Configure::write('Security.cipherSeed', '76859309657453542496749683645');
/** /**
* Compress CSS output by removing comments, whitespace, repeating tags, etc. * Compress CSS output by removing comments, whitespace, repeating tags, etc.

View file

@ -674,8 +674,8 @@ class Debugger extends Object {
trigger_error(__('Please change the value of \'Security.salt\' in app/config/core.php to a salt value specific to your application', true), E_USER_NOTICE); trigger_error(__('Please change the value of \'Security.salt\' in app/config/core.php to a salt value specific to your application', true), E_USER_NOTICE);
} }
if (Configure::read('Security.cipher_seed') == '76859309657453542496749683645') { if (Configure::read('Security.cipherSeed') == '76859309657453542496749683645') {
trigger_error(__('Please change the value of \'Security.cipher_seed\' in app/config/core.php to a numeric (digits only) seed value specific to your application', true), E_USER_NOTICE); trigger_error(__('Please change the value of \'Security.cipherSeed\' in app/config/core.php to a numeric (digits only) seed value specific to your application', true), E_USER_NOTICE);
} }
} }

View file

@ -174,7 +174,7 @@ class Security extends Object {
return ''; return '';
} }
srand(Configure::read('Security.cipher_seed')); srand(Configure::read('Security.cipherSeed'));
$out = ''; $out = '';
for ($i = 0; $i < strlen($text); $i++) { for ($i = 0; $i < strlen($text); $i++) {
@ -184,6 +184,8 @@ class Security extends Object {
$mask = rand(0, 255); $mask = rand(0, 255);
$out .= chr(ord(substr($text, $i, 1)) ^ $mask); $out .= chr(ord(substr($text, $i, 1)) ^ $mask);
} }
srand();
return $out; return $out;
} }
} }