From dfb1bc5eb762bc2f3445a734dca621020beeff43 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 27 Apr 2012 20:07:43 +0000 Subject: [PATCH] Used node id (ex. 'hub id') as old salt and no fixed salt because it will be different from node to node --- application/hub/main/package/class_NetworkPackage.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/application/hub/main/package/class_NetworkPackage.php b/application/hub/main/package/class_NetworkPackage.php index 8c649d371..1fb432da5 100644 --- a/application/hub/main/package/class_NetworkPackage.php +++ b/application/hub/main/package/class_NetworkPackage.php @@ -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( -- 2.39.5