speps/go-hashids

How to just hash 1 id

markthelaw opened this issue · 2 comments

Hi I only want to hash 1 value at a time. The built in function seems to only support an array of int as input.

speps commented

You should be able to use the Go inline slice syntax, same as the example in the README :

h.Encode([]int{45, 434, 1313, 99})

Just put one number in there instead of multiple ones. Works with a variable as well :

h.Encode([]int{myNumber})

You are right, it works. Thanks