Example #1
0
 /**
  * Generates hash keys.
  *
  * @param string|null $hashPassword
  * @param string|null $iv
  *
  * @return array
  */
 private function _roundKeys($hashPassword = null, $iv = null)
 {
     $roundKeys = [];
     $prevKey = $this->_encrypt($this->key, $hashPassword, $iv);
     for ($i = 1; $i <= $this->rounds; $i++) {
         $prevKey = $this->_encrypt($prevKey, $hashPassword, $iv);
         $roundKeys[$i] = substr(DataConverter::rawToBin($prevKey), -1 * $this->sideSize);
     }
     return $roundKeys;
 }
Example #2
0
 /**
  * @covers ::rawToBin
  */
 public function testConvertingFromRawToBin()
 {
     foreach (self::$convertData as $name => $data) {
         $raw = $data['raw'];
         $binary = $data['binary'];
         $msg = 'Convert "%s" from raw to binary form.';
         $result = DataConverter::rawToBin($raw);
         $this->assertEquals($binary, $result, sprintf($msg, $name));
     }
 }