*/
const TCP_PACKAGE_SIZE = 512;
+ /**
+ * Size of the decoded data array
+ */
+ const DECODED_DATA_ARRAY_SIZE = 4;
+
/**************************************************************************
* Stacker for out-going packages *
**************************************************************************/
*/
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);
$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(