]> git.mxchange.org Git - hub.git/commitdiff
Used node id (ex. 'hub id') as old salt and no fixed salt because it will be differen...
authorRoland Häder <roland@mxchange.org>
Fri, 27 Apr 2012 20:07:43 +0000 (20:07 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 27 Apr 2012 20:07:43 +0000 (20:07 +0000)
application/hub/main/package/class_NetworkPackage.php

index 8c649d37152a265c6fb590ced2342acef8bb4af7..1fb432da5e809a30cebb6d7d0d368a2677a3e7f2 100644 (file)
@@ -114,6 +114,11 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
         */
        const TCP_PACKAGE_SIZE = 512;
 
+       /**
+        * Size of the decoded data array
+        */
+       const DECODED_DATA_ARRAY_SIZE = 4;
+
        /**************************************************************************
         *                    Stacker for out-going packages                      *
         **************************************************************************/
@@ -451,7 +456,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
         */
        private function generatePackageSignature ($content, $senderId) {
                // ash content and sender id together, use md5() as last algo
-               $hash = md5($this->getCryptoInstance()->hashString($senderId . $content));
+               $hash = md5($this->getCryptoInstance()->hashString($senderId . $content, $this->getNodeId(), false));
 
                // Encrypt the content again with the hash as a key
                $encryptedContent = $this->getCryptoInstance()->encryptString($content, $hash);
@@ -875,7 +880,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
                $decodedArray = explode(self::PACKAGE_DATA_SEPARATOR, $rawPackageContent);
 
                // Assert on count (should be always 3)
-               assert(count($decodedArray) == 3);
+               assert(count($decodedArray) == self::DECODED_DATA_ARRAY_SIZE);
 
                // Create 'decodedData' array with all assoziative array elements
                $decodedData = array(