hash.go 382 B

123456789101112131415161718192021222324252627
  1. package hash
  2. var _ Hash = (*hash)(nil)
  3. type Hash interface {
  4. i()
  5. // HashidsEncode 加密
  6. HashidsEncode(params []int) (string, error)
  7. // HashidsDecode 解密
  8. HashidsDecode(hash string) ([]int, error)
  9. }
  10. type hash struct {
  11. secret string
  12. length int
  13. }
  14. func New(secret string, length int) Hash {
  15. return &hash{
  16. secret: secret,
  17. length: length,
  18. }
  19. }
  20. func (h *hash) i() {}