Sample code for 30+ languages & platforms
C++

Base62 Encoding and Decoding

Demonstrates base62 encoding and decoding.

Chilkat C++ Downloads

C++
#include <CkBinData.h>
#include <CkStringBuilder.h>

void ChilkatSample(void)
    {
    CkBinData bd;

    // Base62 encode.
    bd.AppendString("hello world","utf-8");
    const char *base62_encoded = bd.getEncoded("base62");
    std::cout << "hello world --> " << base62_encoded << "\r\n";

    // Output: 
    // hello world --> AAwf93rvy4aWQVw

    // Base62 decode
    CkStringBuilder sb;
    sb.DecodeAndAppend("AAwf93rvy4aWQVw","base62","utf-8");
    std::cout << "decoded: " << sb.getAsString() << "\r\n";

    // Output:
    // decoded: hello world
    }