10进制转62进制

func from10To62(num int64)string{
    var str62 []byte
    for{
        var result byte
        var tmp []byte

        number := num % 62 // 100%62 = 38
        result  = dict[number] // C

        // 临时变量,为了追加到头部
        tmp   = append(tmp, result)

        str62 = append(tmp, str62...)
        num   = num / 62

        if num == 0{
            break
        }
    }
    return string(str62)
}

62进制转10进制

func from62To10(str62 string) int64{
    var pos int
    var number int64
    len := len(str62)

    for i := 0; i< len; i++ {
        pos = strings.IndexAny(dict, str62[i:i+1])
        number = int64( math.Pow(62,  float64(len - i - 1) ) * float64(pos) ) + number
    }
    return number
}