Coder Social home page Coder Social logo

go-hashids's Introduction

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

go get github.com/speps/go-hashids

CLI tool :

go get github.com/speps/go-hashids/cmd/hashid

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

go-hashids's People

Contributors

speps avatar dolmen avatar hypnobrando avatar matthewvalimaki avatar md2perpe avatar baijum avatar cgt avatar haarts avatar roosmaa avatar pconcepcion avatar peterhellberg avatar zouxifeng avatar mingrammer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.