Skip to content

Commit

Permalink
Use constants instead of strings.
Browse files Browse the repository at this point in the history
Using built-in constants where possible is generally a good idea,
making code less error prone.
  • Loading branch information
markstory committed Feb 9, 2013
1 parent fee6172 commit 613aa19
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Cake/Utility/Security.php
Expand Up @@ -199,7 +199,7 @@ public static function cipher($text, $key) {
* Encrypts/Decrypts a text using the given key using rijndael method.
*
* @param string $text Encrypted string to decrypt, normal string to encrypt
* @param string $key Key to use
* @param string $key Key to use as the encryption key for encrypted data.
* @param string $operation Operation to perform, encrypt or decrypt
* @return string Encrypted/Descrypted string
*/
Expand All @@ -216,8 +216,8 @@ public static function rijndael($text, $key, $operation) {
trigger_error(__d('cake_dev', 'You must use a key larger than 32 bytes for Security::rijndael()'), E_USER_WARNING);
return '';
}
$algorithm = 'rijndael-256';
$mode = 'cbc';
$algorithm = MCRYPT_RIJNDAEL_256;
$mode = MCRYPT_MODE_CBC;
$cryptKey = substr($key, 0, 32);
$iv = substr($key, strlen($key) - 32, 32);

Expand Down

0 comments on commit 613aa19

Please sign in to comment.