hash_hashids_test.go 330 B

123456789101112131415161718
  1. package hash
  2. import "testing"
  3. const secret = "i1ydX9RtHyuJTrw7frcu"
  4. const length = 12
  5. func TestHashidsEncode(t *testing.T) {
  6. str, _ := New(secret, length).HashidsEncode([]int{99})
  7. t.Log(str)
  8. //GyV5pJqXvwAR
  9. }
  10. func TestHashidsDecode(t *testing.T) {
  11. ids, _ := New(secret, length).HashidsDecode("GyV5pJqXvwAR")
  12. t.Log(ids)
  13. }