Deduplicator: xxh32 digest can collide on large ZIMs

未關閉
#426 3 則留言 0 個 reaction 已指派 1 人 在 GitHub 檢視

維護者通常 1 天內回覆

@i-varunsharma 已經在處理了。

開始於 2026年12月4日。

評估

這個 Issue 還沒有評估資料。

描述

Follow-up from openzim/ifixit#165, as suggested by @benoit74.

Deduplicator keys items by an xxh32 digest only (zim/dedup.py), which is 32-bit. With n deduplicated items the expected number of collisions is about n²/2³³, so roughly 1 around 100k items and ~30 around 500k. A full iFixit ZIM has a lot of images, so two different images could end up with the same digest, and the second one would silently become an alias to the wrong image.

A few options:

  • also store the content size with the digest and compare both, as benoit74 suggested. Cheap, but it only lowers the odds
  • switch to a 128 bit hash (xxhash has xxh3_128), which is about as fast and makes collisions practically impossible
  • both

My suggestion would be xxh3_128 + size as the key. I can open a PR once we agree on the approach.

主要語言
Python
星號
33
分支
36
平均合併
1 天 10 小時
30 天內合併 PR
19

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

openzim/python-scraperlib 的其他 Issue

查看 openzim/python-scraperlib 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。