base62
base62 copied to clipboard
Does not handle negative integers!
While the library claims to deal with int64 and *big.Int, what is not written is that it does not deal well with negative numbers.
e.g. try:
hash := base62.EncodeInt64(-8357271895528378933)
""
Ok, actually, after my surprise that this doesn't work, it actually makes sense that it would not work, as Base62 (or baseXX)-encoding would not be able to represent a negative number anyway..
I've solved my problem by inlining this function:
makeAbs := func(n int64) int64 {
if n < 0 {
return -n
}
return n
}