Example #1
0
 public function testParse()
 {
     $parser = $this->createMemoryParser(hex2bin(self::TEST_HASH_DATA));
     $hash = Hash::parse($parser);
     $this->assertEquals(8208, $hash->getName1());
     $this->assertEquals(1048576, $hash->getName2());
     $this->assertEquals(0, $hash->getLocale());
     $this->assertEquals(16, $hash->getPlatform());
     $this->assertEquals(44510, $hash->getBlockIndex());
 }
Example #2
0
 private function parseHashTable()
 {
     $hashing = new FileKeyHashing();
     $encryptedStream = new EncryptedStream($this->stream, new DefaultEncryption($hashing->hash('(hash table)')));
     $parser = new BinaryStreamParser($encryptedStream);
     $parser->seek($this->getUserDataOffset() + $this->getHeader()->getHashTablePos());
     $hashes = array();
     for ($i = 0; $i < $this->getHeader()->getHashTableSize(); $i++) {
         $hashes[$i] = Hash::parse($parser);
     }
     return new HashTable($hashes);
 }