开始-如何组合多个字符串以输出唯一的“压缩”字符串?

In Go, I'm trying to mix an IP address with a username to output some sort of compressed unique string.

For example: "MyUsername" + "192.354.32.245" = "JDU7DNd"

A UUID can be generated for each user which will generate a random 128 bit value.

However, for a static output, I have written a function which will hash and sum multiple strings which will output a unique value.

func Combine(string ...string) uint32 {
    h := fnv.New32a()

    for _, a := range string {
        h.Write([]byte(a))
    }

    return h.Sum32()
}

https://play.golang.org/p/W_6GUTRJ6b


Contributors: Martin Gallagher (fnv), nevets (uuid).