Re: [go-nuts] How to generate a positive int64 from byte slice

2016-09-24 Thread JohnGB
The 32 bytes were just a product of the hash function that we were using, but I've simplified it by changing the hash function to one that only generates 8 bytes. My current solution is: func EmailToID(email, salt string) int64 { d := sha3.NewShake256() d.Write([]byte(email)) d.Write([]byte(sa

Re: [go-nuts] How to generate a positive int64 from byte slice

2016-09-23 Thread Caleb Spare
You'll probably want to use encoding/binary. But which 8 of the 32 bytes are you going to use? (or really, which 63 bits?) -Caleb On Fri, Sep 23, 2016 at 5:25 PM, JohnGB wrote: > I have a byte slice 32 bytes long, and I would like to use it to generate a > positive int64. Is there a standard w

[go-nuts] How to generate a positive int64 from byte slice

2016-09-23 Thread JohnGB
I have a byte slice 32 bytes long, and I would like to use it to generate a positive int64. Is there a standard way to do this, or do I need to write my own function (most likely using bit shifts)? The backstory is that I need to generate unique (low collision likelihood) integer IDs from emai