VL64 and B64 encoding functions ~ C++ This probably won't be of use to those of you who've moved onto the new crypto, but oh well. Pretty self explanatory, it's a stable port of the VL64 and B64 encoding functions written by Jeax (I believe) and Jordan (his Java port provided the basis for this). VL64 function PHP Code: static string Encode_VL64(int i){ string s = ""; char res[6]; //assign the var res to a a char array - len6 int p = 0; int sP = 0; int bytes = 1; int negativeMask = i >= 0 ? 0 : 4; //? : = if else clause i = abs(i); res[p++] = (char)(64 +(i & 3)); for (i >>= 2; i != 0; i >>= 6){ bytes++; res[p++] = (char)(64 + (i & 0x3f)); } int null = 0; res[sP] = (char)(res[sP] | bytes << 3 | negativeMask); string tmp = string(res); tmp.erase(2,22); //clever little method to cut the string. //If this was not done, the output would have extremely weird chars. return tmp; } B64 function PHP Code: static string Encode_B64(int i){ string s = ""; for (int x = 1; x <= 2; x++){ s += (char)((char)(64 + (i >> 6 * (2 - x) & 0x3f))); } return s; } Usage: PHP Code: #include #include #include using namespace std; int main() { int value; cout << "Enter your value\n"; cin >> value; cout << //either: Encode_B64(value) or Encode_VL64(value); cin.get() return 0; }