From: Roland Häder Date: Tue, 24 Jun 2008 21:27:13 +0000 (+0000) Subject: Randomized garbage added X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=07ed05a76919524d23b337a7e274fcf990e7b17d;p=shipsimu.git Randomized garbage added --- diff --git a/inc/classes/main/crypto/class_CryptoHelper.php b/inc/classes/main/crypto/class_CryptoHelper.php index fbe2df4..6384e0d 100644 --- a/inc/classes/main/crypto/class_CryptoHelper.php +++ b/inc/classes/main/crypto/class_CryptoHelper.php @@ -179,7 +179,43 @@ class CryptoHelper extends BaseFrameworkSystem implements Cryptable { } // Add some "garbage" to the string - $garbageString = md5($this->rngInstance->randomString(10))."|".base64_encode($str)."|".sha1($this->rngInstance->randomString(20)); + switch ($this->rngInstance->randomNumber(0, 8)) { + case 0: + $garbageString = crc32($this->rngInstance->randomString(10))."|".base64_encode($str)."|".crc32($this->rngInstance->randomString(20)); + break; + + case 1: + $garbageString = md5($this->rngInstance->randomString(10))."|".base64_encode($str)."|".crc32($this->rngInstance->randomString(20)); + break; + + case 2: + $garbageString = sha1($this->rngInstance->randomString(10))."|".base64_encode($str)."|".crc32($this->rngInstance->randomString(20)); + break; + + case 3: + $garbageString = crc32($this->rngInstance->randomString(10))."|".base64_encode($str)."|".md5($this->rngInstance->randomString(20)); + break; + + case 4: + $garbageString = crc32($this->rngInstance->randomString(10))."|".base64_encode($str)."|".sha1($this->rngInstance->randomString(20)); + break; + + case 5: + $garbageString = md5($this->rngInstance->randomString(10))."|".base64_encode($str)."|".md5($this->rngInstance->randomString(20)); + break; + + case 6: + $garbageString = md5($this->rngInstance->randomString(10))."|".base64_encode($str)."|".sha1($this->rngInstance->randomString(20)); + break; + + case 7: + $garbageString = sha1($this->rngInstance->randomString(10))."|".base64_encode($str)."|".md5($this->rngInstance->randomString(20)); + break; + + case 8: + $garbageString = sha1($this->rngInstance->randomString(10))."|".base64_encode($str)."|".sha1($this->rngInstance->randomString(20)); + break; + } // Encrypt the string $encrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $garbageString, MCRYPT_MODE_ECB, $iv);