Ejemplo n.º 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;
 }
Ejemplo n.º 2
0
 /**
  * @covers ::rawToHex
  */
 public function testConvertingFromRawToHex()
 {
     foreach (self::$convertData as $name => $data) {
         $raw = $data['raw'];
         $hexadecimal = $data['hexadecimal'];
         $msg = 'Convert "%s" from raw to hexadecimal form.';
         $result = DataConverter::rawToHex($raw);
         $this->assertEquals($hexadecimal, $result, sprintf($msg, $name));
     }
 }