{"id":22415777,"url":"https://github.com/xmas7/go-multihash","last_synced_at":"2025-06-25T14:33:19.762Z","repository":{"id":143167148,"uuid":"533100279","full_name":"xmas7/go-multihash","owner":"xmas7","description":"Note that go-multihash is packaged with Gx, so it is recommended to use Gx to install and use it (see Usage section).","archived":false,"fork":false,"pushed_at":"2022-09-06T00:13:40.000Z","size":78,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T04:18:42.479Z","etag":null,"topics":["go","gx","hash","multi","package"],"latest_commit_sha":null,"homepage":"","language":"Go","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/xmas7.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":"2022-09-06T00:13:22.000Z","updated_at":"2024-05-20T11:09:15.000Z","dependencies_parsed_at":"2023-04-30T02:31:45.041Z","dependency_job_id":null,"html_url":"https://github.com/xmas7/go-multihash","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xmas7/go-multihash","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xmas7%2Fgo-multihash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xmas7%2Fgo-multihash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xmas7%2Fgo-multihash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xmas7%2Fgo-multihash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xmas7","download_url":"https://codeload.github.com/xmas7/go-multihash/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xmas7%2Fgo-multihash/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261891985,"owners_count":23225835,"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","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":["go","gx","hash","multi","package"],"created_at":"2024-12-05T15:13:38.809Z","updated_at":"2025-06-25T14:33:19.738Z","avatar_url":"https://github.com/xmas7.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-multihash\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)\n[![](https://img.shields.io/badge/project-multiformats-blue.svg?style=flat-square)](https://github.com/multiformats/multiformats)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](https://webchat.freenode.net/?channels=%23ipfs)\n[![](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\n[![GoDoc](https://godoc.org/github.com/multiformats/go-multihash?status.svg)](https://godoc.org/github.com/multiformats/go-multihash)\n[![Travis CI](https://img.shields.io/travis/multiformats/go-multihash.svg?style=flat-square\u0026branch=master)](https://travis-ci.org/multiformats/go-multihash)\n[![codecov.io](https://img.shields.io/codecov/c/github/multiformats/go-multihash.svg?style=flat-square\u0026branch=master)](https://codecov.io/github/multiformats/go-multihash?branch=master)\n\n\u003e [multihash](https://github.com/multiformats/multihash) implementation in Go\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n- [Maintainers](#maintainers)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n`go-multihash` is a standard Go module which can be installed with:\n\n```sh\ngo get github.com/multiformats/go-multihash\n```\n\nNote that `go-multihash` is packaged with Gx, so it is recommended to use Gx to install and use it (see Usage section).\n\n## Usage\n\n### Using Gx and Gx-go\n\nThis module is packaged with [Gx](https://github.com/whyrusleeping/gx). In order to use it in your own project it is recommended that you:\n\n```sh\ngo get -u github.com/whyrusleeping/gx\ngo get -u github.com/whyrusleeping/gx-go\ncd \u003cyour-project-repository\u003e\ngx init\ngx import github.com/multiformats/go-multihash\ngx install --global\ngx-go --rewrite\n```\n\nPlease check [Gx](https://github.com/whyrusleeping/gx) and [Gx-go](https://github.com/whyrusleeping/gx-go) documentation for more information.\n\n### Example\n\nThis example takes a standard hex-encoded data and uses `EncodeName` to calculate the SHA1 multihash value for the buffer.\n\nThe resulting hex-encoded data corresponds to: `\u003chash function code\u003e\u003cdigest size\u003e\u003chash function output\u003e`, which could be re-parsed\nwith `Multihash.FromHexString()`.\n\n\n```go\npackage main\n\nimport (\n\t\"encoding/hex\"\n\t\"fmt\"\n\n\t\"github.com/multiformats/go-multihash\"\n)\n\nfunc main() {\n\t// ignores errors for simplicity.\n\t// don't do that at home.\n\t// Decode a SHA1 hash to a binary buffer\n\tbuf, _ := hex.DecodeString(\"0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33\")\n\n\t// Create a new multihash with it.\n\tmHashBuf, _ := multihash.EncodeName(buf, \"sha1\")\n\t// Print the multihash as hex string\n\tfmt.Printf(\"hex: %s\\n\", hex.EncodeToString(mHashBuf))\n\n\t// Parse the binary multihash to a DecodedMultihash\n\tmHash, _ := multihash.Decode(mHashBuf)\n\t// Convert the sha1 value to hex string\n\tsha1hex := hex.EncodeToString(mHash.Digest)\n\t// Print all the information in the multihash\n\tfmt.Printf(\"obj: %v 0x%x %d %s\\n\", mHash.Name, mHash.Code, mHash.Length, sha1hex)\n}\n```\n\nTo run, copy to [example/foo.go](example/foo.go) and:\n\n```\n\u003e cd example/\n\u003e go build\n\u003e ./example\nhex: 11140beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33\nobj: sha1 0x11 20 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33\n```\n\n## Maintainers\n\nCaptain: [@Kubuxu](https://github.com/Kubuxu).\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/multiformats/go-multihash/issues).\n\nCheck out our [contributing document](https://github.com/multiformats/multiformats/blob/master/contributing.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nSmall note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\n## License\n\n[MIT](LICENSE) © 2014 Juan Batiz-Benet\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxmas7%2Fgo-multihash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxmas7%2Fgo-multihash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxmas7%2Fgo-multihash/lists"}