]> git.mxchange.org Git - shipsimu.git/commitdiff
Randomized garbage added
authorRoland Häder <roland@mxchange.org>
Tue, 24 Jun 2008 21:27:13 +0000 (21:27 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 24 Jun 2008 21:27:13 +0000 (21:27 +0000)
inc/classes/main/crypto/class_CryptoHelper.php

index fbe2df4e14c175248dd6cc46b6156fac948d4d52..6384e0d66f01d68f0bfbba84c92c3a7ef21961a8 100644 (file)
@@ -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);