Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/speps/go-hashids
Go (golang) implementation of http://www.hashids.org
https://github.com/speps/go-hashids
golang hashids
Last synced: 6 days ago
JSON representation
Go (golang) implementation of http://www.hashids.org
- Host: GitHub
- URL: https://github.com/speps/go-hashids
- Owner: speps
- License: mit
- Created: 2012-09-22T21:46:39.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2022-06-24T11:49:40.000Z (over 2 years ago)
- Last Synced: 2025-01-02T05:07:44.780Z (13 days ago)
- Topics: golang, hashids
- Language: Go
- Size: 54.7 KB
- Stars: 1,330
- Watchers: 16
- Forks: 111
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- go-awesome - go-hashids - Go version of Hashids (Open source library / Word Processing)
README
go-hashids [![Build Status](https://ci.appveyor.com/api/projects/status/1s8yeafycpa2vdaq?svg=true)](https://ci.appveyor.com/project/speps/go-hashids) [![GoDoc](https://godoc.org/github.com/speps/go-hashids?status.svg)](https://godoc.org/github.com/speps/go-hashids)
==========Go (golang) v1 implementation of http://www.hashids.org
under MIT License (same as the original implementations)Original implementations by [Ivan Akimov](https://github.com/ivanakimov)
### Setup
go get github.com/speps/go-hashids/v2CLI tool :
go get github.com/speps/go-hashids/v2/cmd/hashid### Example
```go
package mainimport "fmt"
import "github.com/speps/go-hashids/v2"func main() {
hd := hashids.NewData()
hd.Salt = "this is my salt"
hd.MinLength = 30
h, _ := hashids.NewWithData(hd)
e, _ := h.Encode([]int{45, 434, 1313, 99})
fmt.Println(e)
d, _ := h.DecodeWithError(e)
fmt.Println(d)
}
```### Thanks to all the contributors
* [Harm Aarts](https://github.com/haarts)
* [Christoffer G. Thomsen](https://github.com/cgt)
* [Peter Hellberg](https://github.com/peterhellberg)
* [Rémy Oudompheng](https://github.com/remyoudompheng)
* [Mart Roosmaa](https://github.com/roosmaa)
* [Jakub Kramarz](https://github.com/jkramarz)
* [Zou Xifeng](https://github.com/zouxifeng)
* [Per Persson](https://github.com/md2perpe)
* [Baiju Muthukadan](https://github.com/baijum)
* [Pablo de la Concepción Sanz](https://github.com/pconcepcion)
* [Olivier Mengué](https://github.com/dolmen)
* [Matthew Valimaki](https://github.com/matthewvalimaki)
* [Cody Maloney](https://github.com/cmaloney)Let me know if I forgot anyone of course.
### Changelog
2021/05/04
* v2.0.1 - Added module support with /v2 suffix
2017/05/09
* Changed API
* `New` methods now return errors
* Added sanity check in `Decode` that makes sure that the salt is consistent2014/09/13
* Updated to Hashids v1.0.0 (should be compatible with other implementations, let me know if not, was checked against the Javascript version)
* Changed API
* Encrypt/Decrypt are now Encode/Decode
* HashID is now constructed from HashIDData containing alphabet, salt and minimum length