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 <jgbeck...@gmail.com> 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 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 email addresses.  However it needs to be that every time a
> given email is used to generate an int64, that it generates the same int64.
> I've settled on using a SHA3 hash with a salt to get a low collision byte
> slice, which I then need to generate a positive int64 from.
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to