{"id":18023454,"url":"https://github.com/meooow25/benc","last_synced_at":"2026-02-18T06:31:16.881Z","repository":{"id":205639510,"uuid":"714290413","full_name":"meooow25/benc","owner":"meooow25","description":"Bencode encoding and decoding library","archived":false,"fork":false,"pushed_at":"2025-03-10T22:10:51.000Z","size":768,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-24T05:03:04.397Z","etag":null,"topics":["bencode","haskell"],"latest_commit_sha":null,"homepage":"","language":"Haskell","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/meooow25.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2023-11-04T13:31:21.000Z","updated_at":"2025-03-10T22:10:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"5c0d3c44-f958-4a41-af5a-1171c8210635","html_url":"https://github.com/meooow25/benc","commit_stats":null,"previous_names":["meooow25/benc"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/meooow25/benc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meooow25%2Fbenc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meooow25%2Fbenc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meooow25%2Fbenc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meooow25%2Fbenc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meooow25","download_url":"https://codeload.github.com/meooow25/benc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meooow25%2Fbenc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266977891,"owners_count":24015485,"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-07-25T02:00:09.625Z","response_time":70,"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":["bencode","haskell"],"created_at":"2024-10-30T07:09:32.055Z","updated_at":"2026-02-18T06:31:16.874Z","avatar_url":"https://github.com/meooow25.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# benc\n\n[![Hackage](https://img.shields.io/hackage/v/benc?logo=haskell\u0026color=blue)](https://hackage.haskell.org/package/benc)\n[![Haskell-CI](https://github.com/meooow25/benc/actions/workflows/haskell-ci.yml/badge.svg)](https://github.com/meooow25/benc/actions/workflows/haskell-ci.yml)\n\nBencode encoding and decoding library\n\n## Bencode\n\nBencode is a simple encoding format for loosely structured data, comparable to\nJSON. It is used primarily in the BitTorrent protocol. For a description of the\nformat see\n\n* [The BitTorrent Protocol Specification (BEP-3)](https://www.bittorrent.org/beps/bep_0003.html)\n* [Bencode on Wikipedia](https://en.wikipedia.org/wiki/Bencode)\n\n## Features\n\nThis library offers\n\n* A nice API\n* Correctness\n* Speed\n\nThis library does not attempt to support\n\n* Lazy or incremental parsing\n* Failing with detailed error messages\n\n## Getting started\n\nPlease see the Haddocks for [`Data.Bencode.Decode`](https://hackage.haskell.org/package/benc/docs/Data-Bencode-Decode.html)\nand [`Data.Bencode.Encode`](https://hackage.haskell.org/package/benc/docs/Data-Bencode-Encode.html).\n\n## Alternatives\n\nThere are currently three other Bencode libraries on Hackage:\n\n* [bencode](https://hackage.haskell.org/package/bencode)\n* [AttoBencode](https://hackage.haskell.org/package/AttoBencode)\n* [bencoding](https://hackage.haskell.org/package/bencoding)\n\nAll of these are in some combination of buggy, slow, and unmaintained.\n\n\u003cdetails\u003e\n\u003csummary\u003eClick for details\u003c/summary\u003e\n\n* `bencode`:\n  * Bugs (e.g. crashes on input `\"i-e\"`)\n  * Very slow parsing\n  * No high-level encoding API\n  * [Minor] Lax parsing (e.g. admits the invalid `\"i-0e\"`)\n* `AttoBencode`\n  * Slow parsing\n  * [Minor] Lax parsing (e.g. admits the invalid `\"i-0e\"`)\n* `bencoding`\n  * Bugs (e.g. crashes on parsing non-UTF-8 into Text)\n  * Questionable design of dict encoding/decoding API, where human error can\n    lead to mis-parsing Bencode or writing invalid Bencode.\n  * [Minor] Lax parsing (e.g. admits the invalid `\"i-0e\"`)\n\n\u003c/details\u003e\n\n### API comparison\n\nSee the [benchmark file](https://github.com/meooow25/benc/blob/master/compare/Bench.hs)\nas a comparison point of the library APIs.\n\n### Benchmarks\n\nBelow is a comparison of decoding and encoding of two torrent files, performed\nwith GHC 9.6.3. See the [benchmark file](https://github.com/meooow25/benc/blob/master/compare/Bench.hs)\nfor details.\n\n#### Decoding\n\n| Library     | `crossref` time  | alloc  | `ubuntu` time    | alloc  |\n| ----------- | ---------------- | ------ | ---------------- | ------ |\n| benc        | 21.3 ms ± 902 μs | 24 MB  | 1.30 μs ± 90 ns  | 3.6 KB |\n| bencode     | 218 ms ± 7.7 ms  | 737 MB | 29.0 μs ± 2.6 μs | 121 KB |\n| AttoBencode | 44.6 ms ± 4.0 ms | 129 MB | 3.01 μs ± 102 ns | 17 KB  |\n| bencoding   | 39.1 ms ± 2.3 ms | 104 MB | 2.44 μs ± 175 ns | 15 KB  |\n\n\u003csup\u003eNote: `bencode` parses from a lazy `ByteString` unlike the rest which parse\nfrom strict `ByteString`s, and so is expected to be a little slower.\u003c/sup\u003e\n\n#### Encoding\n\n| Library     | `crossref` time  | alloc  | `ubuntu` time    | alloc  |\n| ----------- | ---------------- | ------ | ---------------- | ------ |\n| benc        | 9.17 ms ± 487 μs | 42 MB  | 1.58 μs ± 101 ns | 11 KB  |\n| bencode     | 37.8 ms ± 860 μs | 113 MB | 3.17 μs ± 174 ns | 19 KB  |\n| AttoBencode | 19.7 ms ± 1.8 ms | 109 MB | 10.1 μs ± 993 ns | 295 KB |\n| bencoding   | 11.9 ms ± 916 μs | 67 MB  | 1.81 μs ± 129 ns | 15 KB  |\n\n\u003csup\u003eNote: `AttoBencode` encodes to a strict `ByteString` via a lazy\n`ByteString`, unlike the rest, which only prepare the lazy `ByteString`. As\nsuch, it is expected to be slower.\u003c/sup\u003e\n\n## Contributing\n\nQuestions, bug reports, documentation improvements, code contributions welcome!\nPlease [open an issue](https://github.com/meooow25/benc/issues) as the first\nstep.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeooow25%2Fbenc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeooow25%2Fbenc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeooow25%2Fbenc/lists"}