You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Chrome扩展中computed_hashes.json的作用及block_hashes含义咨询

Understanding computed_hashes.json in Chrome Extensions

Great question—this file is a bit of an undocumented internal component of Chrome's extension ecosystem, so it's totally reasonable to be curious about it. Let's break it down:

What's the purpose of computed_hashes.json?

This file is automatically generated by Chrome (you won't find it in the original extension source code you write) as part of the browser's security and integrity checking system. Its core job is to store cryptographic hashes of the extension's files so Chrome can verify that none of the extension's assets have been tampered with after installation or packaging.

Whenever Chrome loads the extension, it can recalculate the hashes of the actual files on disk and compare them against the values stored here. If there's a mismatch, Chrome will flag the extension as potentially compromised and might disable it to protect the user.

What does the block_hashes field mean?

Looking at your file snippet, each entry in file_hashes corresponds to a specific file in the extension (like _locales/en_US/messages-sim.json or adguard/adguard-api.js). The block_hashes array stores hashes of fixed-size chunks (blocks) of that file, rather than a single hash of the entire file.

  • The block_size field (4096 in your example) tells you the size of each chunk in bytes. So Chrome splits the target file into 4KB blocks, calculates a cryptographic hash for each block, encodes that hash as Base64, and adds it to the block_hashes array.
  • Using block-level hashes instead of a single file hash makes integrity checks more efficient: if only a small part of a large file is modified, Chrome only needs to rehash the affected block(s) instead of the entire file. It also reduces memory overhead when dealing with big files.

For example, the entry for adguard/adguard-api.js has one block_hash value, which means the entire file is smaller than or exactly 4KB. If a file was 10KB, you'd see three entries in block_hashes (two full 4KB blocks plus one 2KB block).

内容的提问来源于stack exchange,提问作者hakoum

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 06:38:06