{"id":36703733,"url":"https://github.com/arainko/bencode","last_synced_at":"2026-01-12T11:40:40.567Z","repository":{"id":57732444,"uuid":"330496416","full_name":"arainko/bencode","owner":"arainko","description":"Typesafe and semi-automatically derived bencode encoders/decoders","archived":false,"fork":false,"pushed_at":"2023-06-17T00:15:20.000Z","size":353,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-06-17T01:22:35.003Z","etag":null,"topics":["bencode","derivation","scala","typeclass"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arainko.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}},"created_at":"2021-01-17T22:08:46.000Z","updated_at":"2023-06-17T01:22:35.003Z","dependencies_parsed_at":"2023-01-22T19:30:36.140Z","dependency_job_id":null,"html_url":"https://github.com/arainko/bencode","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/arainko/bencode","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arainko%2Fbencode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arainko%2Fbencode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arainko%2Fbencode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arainko%2Fbencode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arainko","download_url":"https://codeload.github.com/arainko/bencode/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arainko%2Fbencode/sbom","scorecard":{"id":204944,"data":{"date":"2025-08-11","repo":{"name":"github.com/arainko/bencode","commit":"46c72b00c634b9c13eee48b074a3179e70bac073"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-16T23:31:37.633Z","repository_id":57732444,"created_at":"2025-08-16T23:31:37.633Z","updated_at":"2025-08-16T23:31:37.633Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338972,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T10:58:46.209Z","status":"ssl_error","status_checked_at":"2026-01-12T10:58:42.742Z","response_time":98,"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":["bencode","derivation","scala","typeclass"],"created_at":"2026-01-12T11:40:40.495Z","updated_at":"2026-01-12T11:40:40.552Z","avatar_url":"https://github.com/arainko.png","language":"Scala","readme":"## Bencode for Scala\n\nTypesafe bencode encoders and decoders with semi-automatic derivation.\n\n### Installation\n\nAll releases are published on [Maven Central](https://search.maven.org/artifact/io.github.arainko/bencode_2.13).\n\nTo use the library add this to your `build.sbt`:\n```scala\n\nlibraryDependencies += \"io.github.arainko\" %% \"bencode\" % \"0.1.0\"\n\n```\n\n### Example\n\nAssuming these imports:\n\n``` scala\nimport scodec.bits._\nimport zio.stream.ZStream\nimport io.github.arainko.bencode._\nimport io.github.arainko.bencode.syntax._\nimport io.github.arainko.bencode.derivation.semiauto._\n```\n\nGiven a torrent file (eg. `https://releases.ubuntu.com/20.10/ubuntu-20.10-desktop-amd64.iso.torrent`) with a structure like this:\n\n```\nd\n8:announce  35:https://torrent.ubuntu.com/announce\n13:creation date  i1603385085e\n13:announce-list\n  l\n    l\n    35:https://torrent.ubuntu.com/announce\n    e\n    l\n    40:https://ipv6.torrent.ubuntu.com/announce\n    e\n  e\n10:created by  13:mktorrent 1.1\n4:info\n  d\n  6:length  i2942003200e\n  4:name  30:ubuntu-20.10-desktop-amd64.iso\n  12:piece length  i262144e\n  6:pieces  224460: \u003cblob\u003e\n  e\n7:comment  29:Ubuntu CD releases.ubuntu.com\ne\n```\n\nand a structure of case classes:\n\n``` scala\n  final case class Info(length: Long, name: String, pieceLength: Long, pieces: ByteVector)\n\n  final case class TorrentFile(\n    info: Info,\n    announce: String,\n    comment: String,\n    createdBy: String,\n    creationDate: Long,\n    announceList: Seq[Seq[String]]\n  )\n```\n\nWe can parse the .torrent file almost boilerplate free (always make sure you derive the 'inner' parts of your case class/ADT first!):\n\n```  scala\n  implicit val infoDecoder: Decoder[Info] =\n    deriveDecoder[Info]\n      .withFieldsRenamed { case \"piece length\" =\u003e\"pieceLength\" }\n\n  implicit val decoder: Decoder[TorrentFile] = deriveDecoder[TorrentFile].withFieldsRenamed {\n    case \"created by\"    =\u003e \"createdBy\"\n    case \"creation date\" =\u003e \"creationDate\"\n    case \"announce-list\" =\u003e \"announceList\"\n  }\n \n val decoded = \n  for {\n    torrentFile \u003c- ZStream.fromResource(\"ubuntu.torrent\").runCollect.map(_.toArray).map(ByteVector.apply)\n    parsed  = Bencode.parse(torrentFile)\n    decoded = parsed.flatMap(_.cursor.as[TorrentFile])\n  } yield decoded\n \n // output\n Right(\n   TorrentFile(\n      info = Info(\n        length = 2942003200,\n        name = ubuntu-20.10-desktop-amd64.iso,262144,\n        pieces = ByteVector(224460 bytes, #-469656818)\n      ),\n      announce = https://torrent.ubuntu.com/announce,\n      name = Ubuntu CD releases.ubuntu.com,\n      createdBy = mktorrent 1.1,\n      creationDate = 1603385085,\n      announceList = List(List(https://torrent.ubuntu.com/announce), List(https://ipv6.torrent.ubuntu.com/announce))\n   )\n )\n```\n\n### Acknowledgements\nThis library's design is heavily influenced by the great [circe](https://circe.github.io/circe/),\nuses the just-as-great [shapeless](https://github.com/milessabin/shapeless) for typeclass derivation\nand makes use of [scodec's](https://github.com/scodec/scodec) `ByteVector` for binary representation \nof bencoded values.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farainko%2Fbencode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farainko%2Fbencode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farainko%2Fbencode/lists"}