Пример #1
0
 public function xorKey(Byte $key2)
 {
     $length = $key2->getLength();
     for ($i = 0; $i < $length; $i++) {
         $this->byte->setOne($this->byte->getOne($i % 14)->get() ^ $key2->getOne($i)->get(), $i % 14);
     }
     return $this;
 }
Пример #2
0
 private function checkChecksum(Byte $message)
 {
     $checksum = "";
     $length = $message->getLength();
     for ($i = 0; $i < $length; $i++) {
         $checksum ^= $message->getOne($i)->get();
     }
     return $checksum == "";
 }
Пример #3
0
 public function testSetLength()
 {
     $this->byte->setLength(8);
     $this->assertEquals("Mateusz", $this->byte->get());
     $this->assertEquals(8, $this->byte->getLength());
 }