Hex for Hexatridecimal in C ++

I am trying to convert base 16 to base 36. I take the md5 hashes and make them have all 0-9a-z.

I searched around and did not find anything good. Any suggestions for converting hex to hexatridecimal in C ++? Do you guys know good libraries for this?

+3
source share
2 answers

I assume that the hard part you are struggling with is converting to Rad36, not getting an integer value from a hexadecimal number represented as a string. So, here is a function that accepts unsigned __int64, converts it to Radix 36 and returns a string with the converted value.

string rad36(unsigned __int64 v)
{
    string retval;
    while( v > 0 )
    {
        unsigned m = v%36;
        if( m <= 9 )
            retval.insert(0,1,'0'+m);
        else
            retval.insert(0,1,'A'+m-10);
        v /= 36;
    }
    return retval;
}
+3
source

128- () , 36.

, , , 32, ? .

+3

Source: https://habr.com/ru/post/1782600/


All Articles