https://github.com/b58uuid/b58uuid-go
Base58-encoded UUID library for Go with zero dependencies
https://github.com/b58uuid/b58uuid-go
base58 encoding go golang library proxy-url short short-uuid url-safe uuid zero-dependencies
Last synced: 5 months ago
JSON representation
Base58-encoded UUID library for Go with zero dependencies
- Host: GitHub
- URL: https://github.com/b58uuid/b58uuid-go
- Owner: b58uuid
- License: mit
- Created: 2026-01-09T03:27:13.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2026-01-09T07:59:40.000Z (5 months ago)
- Last Synced: 2026-01-11T19:30:16.346Z (5 months ago)
- Topics: base58, encoding, go, golang, library, proxy-url, short, short-uuid, url-safe, uuid, zero-dependencies
- Language: Go
- Homepage:
- Size: 14.6 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# B58UUID for Go
[](https://pkg.go.dev/github.com/b58uuid/b58uuid-go)
[](https://goreportcard.com/report/github.com/b58uuid/b58uuid-go)
[](https://opensource.org/licenses/MIT)
Base58-encoded UUID library for Go with zero dependencies.
## Installation
```bash
go get github.com/b58uuid/b58uuid-go
```
## Usage
```go
package main
import (
"fmt"
"log"
"github.com/b58uuid/b58uuid-go"
)
func main() {
// Generate a new UUID
b58, err := b58uuid.New()
if err != nil {
log.Fatal(err)
}
fmt.Println(b58) // Output: 3FfGK34vwMvVFDedyb2nkf
// Encode existing UUID
encoded, err := b58uuid.Encode("550e8400-e29b-41d4-a716-446655440000")
if err != nil {
log.Fatal(err)
}
fmt.Println(encoded) // Output: BWBeN28Vb7cMEx7Ym8AUzs
// Decode back to UUID
uuid, err := b58uuid.Decode("BWBeN28Vb7cMEx7Ym8AUzs")
if err != nil {
log.Fatal(err)
}
fmt.Println(uuid) // Output: 550e8400-e29b-41d4-a716-446655440000
}
```
## API
### Functions
- `New() (string, error)` - Generate a new random UUID and return Base58 encoding
- `Encode(uuidStr string) (string, error)` - Encode UUID string to Base58
- `Decode(b58Str string) (string, error)` - Decode Base58 string to UUID
- `MustEncode(uuidStr string) string` - Encode UUID, panic on error
- `MustDecode(b58Str string) string` - Decode Base58, panic on error
### Errors
- `ErrInvalidUUID` - Invalid UUID format
- `ErrInvalidB58UUID` - Invalid Base58 string
- `ErrOverflow` - Arithmetic overflow during conversion
## Features
- Zero dependencies (uses only Go standard library)
- Always produces exactly 22 characters
- Uses Bitcoin Base58 alphabet (no 0, O, I, l)
- Full error handling
- Thread-safe
## Testing
```bash
go test -v ./...
```
## License
MIT License - see LICENSE file for details.