{"id":15574571,"url":"https://github.com/runfalk/ed2k-rs","last_synced_at":"2025-08-18T11:48:05.100Z","repository":{"id":41304173,"uuid":"305191215","full_name":"runfalk/ed2k-rs","owner":"runfalk","description":null,"archived":false,"fork":false,"pushed_at":"2023-08-28T16:28:05.000Z","size":20,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-12T13:41:30.958Z","etag":null,"topics":["ed2k"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/runfalk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2020-10-18T20:33:45.000Z","updated_at":"2023-09-10T16:13:40.000Z","dependencies_parsed_at":"2025-03-12T13:40:38.106Z","dependency_job_id":"97a1e586-709d-41ac-a332-2715937723b5","html_url":"https://github.com/runfalk/ed2k-rs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/runfalk/ed2k-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runfalk%2Fed2k-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runfalk%2Fed2k-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runfalk%2Fed2k-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runfalk%2Fed2k-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/runfalk","download_url":"https://codeload.github.com/runfalk/ed2k-rs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runfalk%2Fed2k-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270988238,"owners_count":24680670,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["ed2k"],"created_at":"2024-10-02T18:19:22.576Z","updated_at":"2025-08-18T11:48:05.030Z","avatar_url":"https://github.com/runfalk.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"ed2k-rs\n=======\nAn [ed2k](https://en.wikipedia.org/wiki/Ed2k_URI_scheme) hash implementation in\nRust. It supports both current and legacy variants of calculating the ed2k hash.\nIt does not support AICH hashes.\n\nThis crate implements the [digest](https://github.com/RustCrypto/traits/tree/master/digest)\ncrate's traits for digest algorithms. This means that any changes to this trait\nwill affect the API of this crate.\n\n\nDisclaimer\n----------\n* This is alpha software and the API may change at any time\n* Please don't use this for illegal file sharing\n\n\nPerformance\n-----------\nI have not bothered with super rigorous performance testing. However, on my\ncomputer I have achieved 842 MiB/s in single threaded hashing. `sha256sum` on\nthe same set of files is 1573 MiB/s (also single threaded).\n\n\nExample\n-------\nHow to calculate the hash of a file:\n\n```rust\nuse std::io::Read;\nuse std::fs::File;\nconst BUFFER_SIZE: usize = 4096;\n\n// Use ed2k::Ed2kHasher::with_legacy_hashing(true) for legacy variant\nlet mut hasher = ed2k::Ed2kHasher::new();\nlet mut file = File::open(\"/path/to/file\")?;\n\nlet mut buf = [0u8; BUFFER_SIZE];\nloop {\n    let buf_len = file.read(\u0026mut buf)?;\n    hasher.update(\u0026buf[..buf_len]);\n\n    if buf_len == 0 {\n        break\n    }\n}\n\nprintln!(\"Hash is: {:?}\", hasher.finalize());\n```\n\nSince file hashing is so common there is a convenience wrapper for this:\n\n```rust\n// Use Ed2k::from_path_legacy(...) for legacy variant\nlet ed2k = Ed2k::from_path(\"/path/to/file\")?;\n\n// The Display trait provides an ed2k link in the format\n// ed2k://|file|\u003cfilename\u003e|\u003cfilesize\u003e|\u003chash\u003e|/\nprintln!(\"ed2k URL is {}\", ed2k);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunfalk%2Fed2k-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frunfalk%2Fed2k-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunfalk%2Fed2k-rs/lists"}