Created
June 30, 2015 20:40
-
-
Save dylanpyle/e998fa37e2c18a923968 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ go run test.go | |
laHquq | |
$ ruby test.rb | |
laHquq | |
$ node test.js | |
laHquq | |
$ cat test.go | |
package main | |
import( | |
"fmt" | |
"github.com/speps/go-hashids" | |
) | |
func main() { | |
hd := hashids.NewData() | |
hd.Salt = "this is my salt" | |
h := hashids.NewWithData(hd) | |
e, _ := h.Encode([]int{1, 2, 3}) | |
fmt.Println(e) | |
} | |
$ cat test.rb | |
require 'hashids' | |
hashids = Hashids.new "this is my salt" | |
id = hashids.encode(1, 2, 3) | |
numbers = hashids.decode(id) | |
print id | |
$ cat test.js | |
var Hashids = require('hashids'); | |
var hashids = new Hashids("this is my salt"), | |
id = hashids.encode(1, 2, 3); | |
console.log(id); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment