{"id":18001550,"url":"https://github.com/hehonghui/mdict-analysis","last_synced_at":"2026-02-28T13:32:02.736Z","repository":{"id":146185597,"uuid":"585426561","full_name":"hehonghui/mdict-analysis","owner":"hehonghui","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-05T06:19:54.000Z","size":96,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-17T09:35:00.020Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hehonghui.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-05T06:19:44.000Z","updated_at":"2024-12-17T02:51:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"ddc91f69-2009-4fb5-8432-7f83eddc5679","html_url":"https://github.com/hehonghui/mdict-analysis","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hehonghui/mdict-analysis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hehonghui%2Fmdict-analysis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hehonghui%2Fmdict-analysis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hehonghui%2Fmdict-analysis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hehonghui%2Fmdict-analysis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hehonghui","download_url":"https://codeload.github.com/hehonghui/mdict-analysis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hehonghui%2Fmdict-analysis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29935363,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T13:16:57.922Z","status":"ssl_error","status_checked_at":"2026-02-28T13:11:15.149Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-29T23:17:55.559Z","updated_at":"2026-02-28T13:32:02.691Z","avatar_url":"https://github.com/hehonghui.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"An Analysis of MDX/MDD File Format\r\n==================================\r\n\r\n    MDict is a multi-platform open dictionary\r\n    \r\nwhich are both questionable. It is not available for every platform, e.g. OS X, Linux.\r\nIts  dictionary file format is not open. But this has not hindered its popularity,\r\nand many dictionaries have been created for it.\r\n\r\nThis is an attempt to reveal MDX/MDD file format, so that my favorite dictionaries,\r\ncreated by MDict users, could be used elsewhere.\r\n\r\n\r\nMDict Files\r\n===========\r\nMDict stores the dictionary definitions, i.e. (key word, explanation) in MDX file and\r\nthe dictionary reference data, e.g. images, pronunciations, stylesheets in MDD file.\r\nAlthough holding different contents, these two file formats share the same structure.\r\n\r\nMDict v1 and v2 Format\r\n======================\r\nMdxBuilder 2.x creates v1 format and MdxBuilder 3.x creates v2 format.\r\n\r\n.. image:: MDX.svg\r\n\r\n.. image:: MDD.svg\r\n\r\nMDict v3 Format\r\n===============\r\nMdxBuilder 4.x creates v3 format. The major changes are,\r\n\r\n* The file is divided into 4 blocks, i.e. key index, key data, record index and record data.\r\n  And all blocks have the same structure. The decoded block holds type dependent data.\r\n* Partial block data (first 16 bytes as now) is always encrypted (after possible compression), via _fast_encrypt or _salsa_encrypt.\r\n  The encryption key derives globally from the dictionary header's UUID value (since MdxBuilder 4.0 RC4), ::\r\n\r\n    key = xxh64_digest(uuid[:18]) + xxh64_digest(uuid[18:])\r\n\r\n  or individually from each block data's Adler-32 checksum (until MdxBuilder 4.0 RC2), ::\r\n\r\n    key = ripemd128(alder)\r\n\r\n.. image:: MDict3.svg\r\n\r\nExample Programs\r\n================\r\n\r\nreadmdict.py\r\n------------\r\nreadmdict.py is an example implementation in Python. This program can read/extract mdx/mdd files.\r\n\r\n.. note:: python-lzo is required to read mdx files created with engine 1.2.\r\n   xxhash is required to read mdx files created with engine 3.0.\r\n   Get Windows version from http://www.lfd.uci.edu/~gohlke/pythonlibs\r\n\r\nIt can be used as a command line tool. Suppose one has *oald8.mdx* and *oald8.mdd*::\r\n\r\n    $ python readmdict.py -x oald8.mdx\r\n\r\nThis will create a dictionary file *oald8.txt* and a folder *data* for images, pronunciation audio files.\r\n\r\nOn Windows, one can also double click it and select the file in the popup dialog.\r\n\r\nOr as a module::\r\n\r\n    In [1]: from readmdict import MDX, MDD\r\n\r\nRead MDX file and print the first entry::\r\n\r\n    In [2]: mdx = MDX('oald8.mdx')\r\n\r\n    In [3]: items = mdx.items()\r\n\r\n    In [4]: next(items)\r\n    Out[4]:\r\n    ('A',\r\n     '\u003cspan style=\\'display:block;color:black;\\'\u003e.........')\r\n\r\n``mdx`` is an object having all info from a MDX file. ``items`` is an iterator producing 2-item tuples.\r\nOf each tuple, the first element is the entry text and the second is the explanation. Both are UTF-8 encoded strings.\r\n\r\nRead MDD file and print the first entry::\r\n\r\n    In [5]: mdd = MDD('oald8.mdd')\r\n\r\n    In [6]: items = mdd.items()\r\n\r\n    In [7]: next(items)\r\n    Out[7]: \r\n    (u'\\\\pic\\\\accordion_concertina.jpg',\r\n    '\\xff\\xd8\\xff\\xe0\\x00\\x10JFIF...........')\r\n\r\n``mdd`` is an object having all info from a MDD file. ``items`` is an iterator producing 2-item tuples. \r\nOf each tuple, the first element is the file name and the second element is the corresponding file content.\r\nThe file name is encoded in UTF-8. The file content is a plain bytes array.\r\n\r\nAcknowledge\r\n===========\r\nThe file format gets fully disclosed by https://github.com/zhansliu/writemdict.\r\nThe encryption part is taken into this project.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhehonghui%2Fmdict-analysis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhehonghui%2Fmdict-analysis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhehonghui%2Fmdict-analysis/lists"}