Skip to content

Add %{ed2k-hashset} format specifier - #337

Open
rowaasr13 wants to merge 4 commits into
rhash:masterfrom
rowaasr13:master
Open

rowaasr13 wants to merge 4 commits into
rhash:masterfrom
rowaasr13:master

Conversation

@rowaasr13

@rowaasr13 rowaasr13 commented Nov 21, 2026 •

Copy link
Copy Markdown

Closes #183. Though it does not cover all possible functionality, it is self-contained and can be expanded further in future PRs.

I've implemented minimal amount of changes required to support printing e2dk hashset. Command line flag support, --check, --update, library bindings support can be built on top of it.

I deliberately limited scope to minimal changes to let it be reviewed by author to check if this approach is good before further changes, but I kept in mind future expansion.

It uses custom print_bytes variant because of its variable-width nature.
Hashset storage is only allocated if ed2k-hashset is explicitly requested.
Setting both e2dk and ed2k-hashset is verified to perform work only once.

Local test cases were generated by running eMule and copypasting its generated links and then running newly compiled rhash and verifying that it outputs exactly same value with small Perl script. All files except mkvtoolnix consist entirely from repeated 0 byte. For size-chunk-minus-1.bin and shorter files eMule generates no hashest and rhash format specifier outputs empty string too.

ed2k://|file|mkvtoolnix-32-bit-63.0.0.7z|22373566|8279F42781880E63F9FB79CC6AACFE17|p=D7431F60C6A4F4683CDCCECD89E7E346:F9AE4B6064C6DDC2D933B5B5DF9ABAC9:9EBC3D7AAD75624D7C439E392ED145AC|h=KA7BPLJ5HFMWY222XU3QYBRY3T2CHNEQ|/
ed2k://|file|size-00000001-1B.bin|1|47C61A0FA8738BA77308A8A600F88E4B|h=LOUTZHNQZ74T6UVVEHLUEDSD63W2E6CP|/
ed2k://|file|size-17chunks-exact.bin|165376000|DD52059D06F5292C136D8D1875A89015|p=D7DEF262A127CD79096A108E7A9FC138:D7DEF262A127CD79096A108E7A9FC138:D7DEF262A127CD79096A108E7A9FC138:D7DEF262A127CD79096A108E7A9FC138:D7DEF262A127CD79096A108E7A9FC138:D7DEF262A127CD79096A108E7A9FC138:D7DEF262A127CD79096A108E7A9FC138:D7DEF262A127CD79096A108E7A9FC138:D7DEF262A127CD79096A108E7A9FC138:D7DEF262A127CD79096A108E7A9FC138:D7DEF262A127CD79096A108E7A9FC138:D7DEF262A127CD79096A108E7A9FC138:D7DEF262A127CD79096A108E7A9FC138:D7DEF262A127CD79096A108E7A9FC138:D7DEF262A127CD79096A108E7A9FC138:D7DEF262A127CD79096A108E7A9FC138:D7DEF262A127CD79096A108E7A9FC138:31D6CFE0D16AE931B73C59D7E0C089C0|h=Q77MMFGVKNEZVX2W5QT5PKVNK2DQHTGZ|/
ed2k://|file|size-2chunks-exact.bin|19456000|114B21C63A74B6CA922291A11177DD5C|p=D7DEF262A127CD79096A108E7A9FC138:D7DEF262A127CD79096A108E7A9FC138:31D6CFE0D16AE931B73C59D7E0C089C0|h=EEXRXRAV5SIJN5I2EITKIBPCXQ6QWG4E|/
ed2k://|file|size-2chunks-minus-1.bin|19455999|A4AED104A077DE7E4210E7F5B131FE25|p=D7DEF262A127CD79096A108E7A9FC138:AC44B93FC9AFF773AB0005C911F8396F|h=DRVRGO2QODDHREBEH77VHNCUX2TNJJVI|/
ed2k://|file|size-2chunks-plus-1.bin|19456001|E57F824D28F69FE90864E17673668457|p=D7DEF262A127CD79096A108E7A9FC138:D7DEF262A127CD79096A108E7A9FC138:47C61A0FA8738BA77308A8A600F88E4B|h=A24DAJJZDJ7ZW7ER5MK7Y4U2SW3VC7CW|/
ed2k://|file|size-chunk-exact.bin|9728000|FC21D9AF828F92A8DF64BEAC3357425D|p=D7DEF262A127CD79096A108E7A9FC138:31D6CFE0D16AE931B73C59D7E0C089C0|h=5D3N4HQHIUMQ7IU7A5QLPLI6RHSWOR7B|/
ed2k://|file|size-chunk-minus-1.bin|9727999|AC44B93FC9AFF773AB0005C911F8396F|h=L6SPMD2CM6PRZBGRQ6UFC4HJFFOATRA4|/
ed2k://|file|size-chunk-plus-1.bin|9728001|06329E9DBA1373512C06386FE29E3C65|p=D7DEF262A127CD79096A108E7A9FC138:47C61A0FA8738BA77308A8A600F88E4B|h=HL3TFXORIUEPXUWFPY3JLR7SMKGTO4IH|/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add output of ed2k complete hashset

2 participants