My simple code with the Crypto ++ library:
string base58_encode(Integer num, string vers) { string alphabet[58] = {"1","2","3","4","5","6","7","8","9","A","B","C","D","E","F", "G","H","J","K","L","M","N","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c", "d","e","f","g","h","i","j","k","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}; int base_count = 58; string encoded; Integer div; Integer mod; while (num >= base_count) { div = num / base_count; mod = (num - (base_count * div)); encoded = alphabet[ mod.ConvertToLong() ] + encoded; num = div; } encoded = vers + alphabet[ num.ConvertToLong() ] + encoded; return encoded; }
It just for cryptocurrency wallets. string can be changed for other tasks.