go-hashids

Go (golang) implementation of http://www.hashids.org

  • Owner: speps/go-hashids
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

go-hashids Build Status GoDoc

Go (golang) v1 implementation of http://www.hashids.org
under MIT License (same as the original implementations)

Original implementations by Ivan Akimov

Setup

CLI tool :

Example

package main

import "fmt"
import "github.com/speps/go-hashids"

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

Let me know if I forgot anyone of course.

Changelog

2017/05/09

  • Changed API
    • New methods now return errors
    • Added sanity check in Decode that makes sure that the salt is consistent

2014/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

Main metrics

Overview
Name With Ownerspeps/go-hashids
Primary LanguageGo
Program languageGo (Language Count: 1)
Platform
License:MIT License
所有者活动
Created At2012-09-22 21:46:39
Pushed At2022-06-24 11:49:40
Last Commit At2021-05-04 18:47:04
Release Count3
Last Release Namev2.0.1 (Posted on )
First Release Namev1.0.0 (Posted on )
用户参与
Stargazers Count1.3k
Watchers Count15
Fork Count110
Commits Count84
Has Issues Enabled
Issues Count35
Issue Open Count6
Pull Requests Count19
Pull Requests Open Count3
Pull Requests Close Count7
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private