{"id":26713530,"url":"https://github.com/atprotokit/multiformatskit","last_synced_at":"2026-04-29T08:01:39.022Z","repository":{"id":284451803,"uuid":"954917559","full_name":"ATProtoKit/MultiformatsKit","owner":"ATProtoKit","description":"A Swift implementation of the Multiformats spec, including Multibase, Multicodec, Multihash, and CID.","archived":false,"fork":false,"pushed_at":"2026-03-21T05:54:01.000Z","size":446,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-23T01:37:48.079Z","etag":null,"topics":["cid","ipfs","ipld","multibase","multicodec","multiformats","multihash"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ATProtoKit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["MasterJ93"]}},"created_at":"2025-03-25T20:20:05.000Z","updated_at":"2026-03-21T05:51:17.000Z","dependencies_parsed_at":"2025-03-26T00:50:35.130Z","dependency_job_id":null,"html_url":"https://github.com/ATProtoKit/MultiformatsKit","commit_stats":null,"previous_names":["atprotokit/multiformatskit"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ATProtoKit/MultiformatsKit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ATProtoKit%2FMultiformatsKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ATProtoKit%2FMultiformatsKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ATProtoKit%2FMultiformatsKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ATProtoKit%2FMultiformatsKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ATProtoKit","download_url":"https://codeload.github.com/ATProtoKit/MultiformatsKit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ATProtoKit%2FMultiformatsKit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32416146,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T06:29:02.080Z","status":"ssl_error","status_checked_at":"2026-04-29T06:29:00.631Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["cid","ipfs","ipld","multibase","multicodec","multiformats","multihash"],"created_at":"2025-03-27T12:29:13.912Z","updated_at":"2026-04-29T08:01:39.016Z","avatar_url":"https://github.com/ATProtoKit.png","language":"Swift","funding_links":["https://github.com/sponsors/MasterJ93"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/ATProtoKit/MultiformatsKit/blob/main/Sources/MultiformatsKit/MultiformatsKit.docc/Resources/multiformatskit_icon.png\" height=\"128\" alt=\"A icon for MultiformatsKit, which contains three stacks of rounded rectangles in an isometric top view. At the top stack, the Multiformats logo is displayed. The three stacks are in various shades of blue.\"\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eMultiformatsKit\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FATProtoKit%2FMultiformatsKit%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/ATProtoKit/MultiformatsKit)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FATProtoKit%2FMultiformatsKit%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/ATProtoKit/MultiformatsKit)\n[![GitHub Repo stars](https://img.shields.io/github/stars/ATProtoKit/MultiformatsKit?style=flat\u0026logo=github)](https://github.com/ATProtoKit/MultiformatsKit)\n\n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003e\n\n[![Static Badge](https://img.shields.io/badge/Follow-%40cjrriley.ca-0073fa?style=flat\u0026logo=bluesky\u0026labelColor=%23151e27\u0026link=https%3A%2F%2Fbsky.app%2Fprofile%2Fcjrriley.ca)](https://bsky.app/profile/cjrriley.ca)\n[![GitHub Sponsors](https://img.shields.io/github/sponsors/masterj93?color=%23cb5f96\u0026link=https%3A%2F%2Fgithub.com%2Fsponsors%2FMasterJ93)](https://github.com/sponsors/MasterJ93)\n\n\u003c/div\u003e\n\n**MultiformatsKit** is a native Swift implementation of the [Multiformats](https://multiformats.io) protocol suite — including [Multibase](https://github.com/multiformats/multibase), [Multicodec](https://github.com/multiformats/multicodec), [Multihash](https://github.com/multiformats/multihash), and [CID](https://github.com/multiformats/cid).\n\nThis package enables content-addressing, self-describing data structures, and CID generation — all with `Sendable`-safe Swift code.\n\n## Quick Examples\n\n### CID\n```swift\nimport MultiformatsKit\n\nTask {\n    do {\n        let cid = try await CID(content: \"Hello, World!\")\n\n        // CIDv1 encoded with base32\n        print(\"CIDv1:\", try cid.encode())\n\n        // Decode back into a CID\n        let decoded = try await CID.decode(from: cid.encode())\n        print(\"Decoded multihash:\", decoded.multihash)\n    } catch {\n        print(\"Error:\", error)\n    }\n}\n```\n\n### Multibase\n```swift\nimport MultiformatsKit\n\ndo {\n    let base58 = Multibase.base58btc\n    let result = multibase.encode(\"Hello from Multibase!\")\n    \n    print(result) // Will return as \"4QBebtZN9VvWV59DoFiqFLTfq2CJp\".\n} catch {\n    throw error\n}\n```\n\n### Multicodec\n\n```swift\n// Original binary data\nlet rawData = Data([0xde, 0xad, 0xbe, 0xef])\n\n// Select a codec (e.g., raw binary)\nlet codec = Multicodec.raw\n\n// Wrap the raw data with the codec’s prefix\nlet wrapped = codec.wrap(rawData)\nprint(\"Wrapped: \\(wrapped)\")\n\n// Unwrap the data\ndo {\n    let unwrapped = try codec.unwrap(wrapped)\n    print(\"Unwrapped: \\(unwrapped)\")\n} catch {\n    print(error)\n}\n```\n\n### Multihash\n\n```swift\nTask {\n    do {\n        let data = Data(\"hello\".utf8)\n        let algorithm = try SHA256Multihash()\n        try await MultihashFactory.shared.register(algorithm)\n\n        let multihash = try await MultihashFactory.shared.hash(using: \"sha2-256\", data: data)\n        // Prints as [0xdd, 0x7d, 0x93, 0xb5, 0xcc, 0xe6, 0x1c, 0x9e, 0xf6, 0x36, 0x5b, 0xf0, 0x9b, 0x41, 0xa8, 0xb0, 0x6f, 0xce, 0x69, 0x9a, 0xf4, 0x58, 0x76, 0xe3, 0x27, 0x0c, 0xb4, 0x65, 0xa1, 0x7a, 0xec, 0xb4]\n        print(multihash.encoded.map { String(format: \"%02x\", $0) }.joined())\n    } catch {\n        throw error\n    }\n}\n```\n\n## Features\n\n- Fully `Sendable`-safe and concurrency-ready.\n- Supports CIDv0 and CIDv1 (including `dag-pb` with `sha2-256`).\n- Multibase encoding/decoding with support for:\n  - Base2, Base8, Base10, Base16\n  - Base58 (BTC, Flickr)\n  - Base32 (lower/upper, padded/unpadded, hex variants)\n- Multicodec registration.\n- Multihash support with plug-and-play hashing algorithms.\n- RFC 4648 compliance for fixed-bit encoding.\n- Varint encoding/decoding.\n- Written entirely in Swift — no C or unsafe code.\n\n## Installation\n\nYou can use the Swift Package Manager to download and import the library into your project:\n```swift\ndependencies: [\n    .package(url: \"https://github.com/ATProtoKit/MultiformatsKit.git\", from: \"0.3.0\")\n]\n```\n\nThen under `targets`:\n```swift\ntargets: [\n    .target(\n        // name: \"[name of target]\",\n        dependencies: [\n            .product(name: \"MultiformatsKit\", package: \"multiformatskit\")\n        ]\n    )\n]\n```\n\n## Requirements\nTo use MultiformatsKit in your apps, your app should target the specific version numbers:\n- **iOS** and **iPadOS** 14 or later.\n- **macOS** 12 or later.\n- **tvOS** 14 or later.\n- **visionOS** 1 or later.\n- **watchOS** 9 or later.\n\nFor Linux, you need to use Swift 6.0 or later. On Linux, the minimum requirements include:\n- **Amazon Linux** 2\n- **Debian** 12\n- **Fedora** 39\n- **Red Hat UBI** 9\n- **Ubuntu** 20.04\n\nYou can also use this project for any programs you make using Swift and running on **Docker**.\n\n\u003e [!WARNING]\n\u003e As of right now, Windows support is theoretically possible, but not has not been tested to work. Contributions and feedback on making it fully compatible for Windows and Windows Server are welcomed.\n\n## Submitting Contributions and Feedback\nWhile this project will change significantly, feedback, issues, and contributions are highly welcomed and encouraged. If you'd like to contribute to this project, please be sure to read both the [API Guidelines](https://github.com/ATProtoKit/MultiformatsKit/blob/main/API_GUIDELINES.md) as well as the [Contributor Guidelines](https://github.com/MasterJ93/ATProtoKit/blob/main/CONTRIBUTING.md) before submitting a pull request. Any issues (such as bug reports or feedback) can be submitted in the [Issues](https://github.com/ATProtoKit/MultiformatsKit/issues) tab. Finally, if there are any security vulnerabilities, please read [SECURITY.md](https://github.com/ATProtoKit/MultiformatsKit/blob/main/SECURITY.md) for how to report it.\n\nIf you have any questions, you can ask me on Bluesky ([@cjrriley.ca](https://bsky.app/profile/cjrriley.ca)). And while you're at it, give me a follow! I'm also active on the [Bluesky API Touchers](https://discord.gg/3srmDsHSZJ) Discord server.\n\n## License\nThis Swift package is using the Apache 2.0 License. Please view [LICENSE.md](https://github.com/ATProtoKit/MultiformatsKit/blob/main/LICENSE.md) for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatprotokit%2Fmultiformatskit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatprotokit%2Fmultiformatskit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatprotokit%2Fmultiformatskit/lists"}