{"id":28906664,"url":"https://github.com/cyclone-github/base58","last_synced_at":"2026-04-29T10:02:22.782Z","repository":{"id":286884229,"uuid":"962872342","full_name":"cyclone-github/base58","owner":"cyclone-github","description":"Lightweight, high performance Base58 Implementation in Pure Go","archived":false,"fork":false,"pushed_at":"2025-04-09T22:41:04.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-09T11:51:13.440Z","etag":null,"topics":["base58","base64","bitcoin","btc","btcutil","decode","encode","go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cyclone-github.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":"2025-04-08T19:59:51.000Z","updated_at":"2025-04-09T22:41:08.000Z","dependencies_parsed_at":"2025-04-08T21:19:55.633Z","dependency_job_id":"bfbe942a-c909-4a18-8167-069d490c328c","html_url":"https://github.com/cyclone-github/base58","commit_stats":null,"previous_names":["cyclone-github/base58"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/cyclone-github/base58","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyclone-github%2Fbase58","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyclone-github%2Fbase58/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyclone-github%2Fbase58/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyclone-github%2Fbase58/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cyclone-github","download_url":"https://codeload.github.com/cyclone-github/base58/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyclone-github%2Fbase58/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261143150,"owners_count":23115675,"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":["base58","base64","bitcoin","btc","btcutil","decode","encode","go","golang"],"created_at":"2025-06-21T15:08:36.391Z","updated_at":"2026-04-29T10:02:22.776Z","avatar_url":"https://github.com/cyclone-github.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Readme Card](https://github-readme-stats-fast.vercel.app/api/pin/?username=cyclone-github\u0026repo=base58\u0026theme=gruvbox)](https://github.com/cyclone-github/base58/)\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/cyclone-github/base58)](https://goreportcard.com/report/github.com/cyclone-github/base58)\n[![GitHub issues](https://img.shields.io/github/issues/cyclone-github/base58.svg)](https://github.com/cyclone-github/base58/issues)\n[![License](https://img.shields.io/github/license/cyclone-github/base58.svg)](LICENSE)\n[![GitHub release](https://img.shields.io/github/release/cyclone-github/base58.svg)](https://github.com/cyclone-github/base58/releases) [![Go Reference](https://pkg.go.dev/badge/github.com/cyclone-github/base58.svg)](https://pkg.go.dev/github.com/cyclone-github/base58)\n\n---\n\n# Base58\n\nBase58 is a pure Go implementation of the Bitcoin Base58 encoding and decoding scheme, based on and following a similar API as the official Go stdlib [encoding/base64](https://pkg.go.dev/encoding/base64) package.\n\n## Overview\n\nUnlike other implementations (such as the btcutil version that uses big.Int for arithmetic), this Base58 package uses custom repeated division routines that work on raw byte slices. This approach offers:\n\n- **Speed \u0026 Memory Efficiency:** Fewer allocations and less overhead for typical input sizes (e.g. crypto addresses, public key hashes, short strings).\n- **Familiar API:** Modeled on Go’s standard `encoding/base64` package for ease of use and consistency.\n- **Stream Support:** Provides stream encoder and decoder wrappers via `NewEncoder` and `NewDecoder`.\n\n## Features\n\n### Available Functions\n\n#### Initialization\n- **NewEncoding(alphabet string) Encoding**  \n  Returns a new Base58 encoding scheme using the specified 58-character alphabet.\n\n- **StdEncoding**  \n  A pre-initialized `Encoding` using the standard Bitcoin alphabet:  \n  `\"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\"`\n\n#### Encoding\n- **(enc Encoding) Encode(dst, src []byte) int**  \n  Encodes `src` into Base58, writes the result to `dst`, and returns the number of bytes written.\n\n- **(enc Encoding) EncodeToBytes(src []byte) []byte**  \n  Returns the Base58 encoding of `src` as a byte slice.\n\n- **(enc Encoding) EncodeToString(src []byte) string**  \n  Returns the Base58 encoding of `src` as a string.\n\n#### Decoding\n- **(enc Encoding) Decode(dst, src []byte) (int, error)**  \n  Decodes Base58-encoded `src` into `dst` and returns the number of decoded bytes along with an error if any.\n\n- **(enc Encoding) DecodeToBytes(src []byte) ([]byte, error)**  \n  Returns a byte slice containing the decoded data from Base58-encoded `src`.\n\n- **(enc Encoding) DecodeString(s string) ([]byte, error)**  \n  Decodes the Base58 string `s` and returns the corresponding byte slice.\n\n#### Stream Functions\n- **NewEncoder(enc Encoding, w io.Writer) io.WriteCloser**  \n  Returns a new stream encoder that writes Base58-encoded data to `w`. The data is buffered and encoded when `Close()` is called.\n\n- **NewDecoder(enc Encoding, r io.Reader) io.Reader**  \n  Returns a new stream decoder that reads Base58-encoded data from `r` and provides the decoded output.\n\n## Usage\n\n### One-Shot Encoding \u0026 Decoding\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/cyclone-github/base58\"\n)\n\nfunc main() {\n\tdata := []byte(\"hello world\")\n\tencoded := base58.StdEncoding.EncodeToString(data)\n\tfmt.Println(\"Encoded:\", encoded)\n\n\tdecoded, err := base58.StdEncoding.DecodeString(encoded)\n\tif err != nil {\n\t\tlog.Fatalf(\"Decode error: %v\", err)\n\t}\n\tfmt.Println(\"Decoded:\", string(decoded))\n}\n```\n\n### Stream-Based Encoding \u0026 Decoding\n\n```go\npackage main\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"log\"\n\n\t\"github.com/cyclone-github/base58\"\n)\n\nfunc main() {\n\t// Example of streaming encoding:\n\tvar encodedBuffer bytes.Buffer\n\tencoder := base58.NewEncoder(base58.StdEncoding, \u0026encodedBuffer)\n\tencoder.Write([]byte(\"streaming data\"))\n\tencoder.Close()\n\tfmt.Println(\"Stream Encoded:\", encodedBuffer.String())\n\n\t// Example of streaming decoding:\n\tdecoder := base58.NewDecoder(base58.StdEncoding, \u0026encodedBuffer)\n\tdecodedBytes, err := io.ReadAll(decoder)\n\tif err != nil {\n\t\tlog.Fatalf(\"Stream decode error: %v\", err)\n\t}\n\tfmt.Println(\"Stream Decoded:\", string(decodedBytes))\n}\n```\n\n## Comparison to Go's stdlib \"encoding/base64\"\n\nThis Base58 package closely follows the design of Go’s `encoding/base64` package:\n\n- **API Parity:**  \n  Both packages use an `Encoding` type with methods like `EncodeToString` and `DecodeString`, making the Base58 API familiar to Go developers.\n\n- **Stream Processing:**  \n  Just like the base64 package, this package provides stream encoder and decoder wrappers through `NewEncoder` and `NewDecoder`.\n\n- **Efficiency:**  \n  While the standard library’s base64 handles 6-bit groups for Base64 conversion, this Base58 package uses custom repeated division routines on raw byte slices. Compared to other Base58 implementations that rely on `math/big`, this approach avoids the overhead of arbitrary-precision arithmetic, thus offering improved performance for typical inputs.\n\n- **Extensibility:**  \n  The package can easily be extended to support alternate Base58 alphabets or custom variants, similar to how custom encodings can be created with `encoding/base64`.\n\n## Installation \u0026 Import\n\nTo install, run:\n\n```bash\ngo get github.com/cyclone-github/base58\n```\n\nThen import the package in your project:\n\n```go\nimport \"github.com/cyclone-github/base58\"\n```\n\n## License\n\nThis project is licensed under the BSD 3-Clause License. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyclone-github%2Fbase58","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyclone-github%2Fbase58","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyclone-github%2Fbase58/lists"}