def readBlockHash(self, chunk_id, hash_datatype): bevy_id = old_div(chunk_id, self.chunks_per_segment) bevy_blockHash_urn = self._get_block_hash_urn(bevy_id, hash_datatype) blockLength = hashes.length(hash_datatype) with self.resolver.AFF4FactoryOpen( bevy_blockHash_urn) as bevy_blockHashes: idx = chunk_id * blockLength bevy_blockHashes.SeekRead(idx) hash_value = bevy_blockHashes.Read(blockLength) return hashes.newImmutableHash(binascii.hexlify(hash_value), hash_datatype)
def readBlockHash(self, chunk_id, hash_datatype): bevy_id = old_div(chunk_id, self.chunks_per_segment) bevy_blockHash_urn = self.urn.Append( "%08d.blockHash.%s" % (bevy_id, hashes.toShortAlgoName(hash_datatype))) blockLength = hashes.length(hash_datatype) with self.resolver.AFF4FactoryOpen( bevy_blockHash_urn) as bevy_blockHashes: idx = chunk_id * blockLength bevy_blockHashes.Seek(idx) hash_value = bevy_blockHashes.Read(blockLength) return hashes.newImmutableHash(hash_value.encode('hex'), hash_datatype)