Epoch hashing
ssorenso opened this issue · 1 comments
ssorenso commented
Hi Team,
I don't know whether or not you think this is a valid bug or not.
If I do something like:
// HashMaker performs a salted hash based upon epoch
func HashMaker() string {
now := time.Now()
hash := hashids.NewData()
value := now.Unix()
hash.Salt = "hello world"
h, _ := hashids.NewWithData(hash)
e, _ := h.Encode(toIntSlice(string(value)))
got, _ := h.DecodeWithError(e)
fmt.Println("should be", value, "got", got)
return e
}
I get something like:
should be 1538515448 got [65533]
jolM
should be 1538515449 got [65533]
jolM
should be 1538515450 got [65533]
jolM
should be 1538515451 got [65533]
jolM
I guess that my expectation is to see something like:
should be <epoch> got <epoch>
<hash>
I am sending the epoch as a string into the hash as data, and I can replace it for the salt as well, and it results in the same problem.