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 <iostream>
#include <string>
#include <math.h>
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;
}
Compiled binary, VS solution and source code:
http://jokercode.net/utils/packetscout++.zip
Pictures of it functioning:
http://i.imgur.com/ZUap2.png
http://i.imgur.com/DmCOz.png
Notes:
Don't go off releasing this under your name.
Option 3 will output "coming soon", due to native C++ not having certain classes and functions built-in.
Report any bugs here. (If you enter a string for menu selection, prepare for errors).
~Adil
Re: VL64 and B64 encoding functions ~ C++
thank you ;D
Native C++ FTW!! ;D
Waves ~
Re: VL64 and B64 encoding functions ~ C++
Thank you, I forgot this part to add to mines :
Code:
tmp.erase(2,22); //clever little method to cut the string.
//If this was not done, the output would have extremely weird chars.
Also thanks for this :)
Re: VL64 and B64 encoding functions ~ C++
Great release Adil, saw some screenies on DB.
Re: VL64 and B64 encoding functions ~ C++
Has anyone tested it out?
What are your thoughts?
Re: VL64 and B64 encoding functions ~ C++
I converted them a few days ago into C++, but forgot some things like erase etc.
My opinion: Works great lol'd
Re: VL64 and B64 encoding functions ~ C++
Notes:
Updated build. Latest can be found at the same directory, http://jokercode.net/utils/packetscout++.zip
Updates:
-RC4 has been implemented. If you wish to encrypt something with RC4, please change:
Code:
rc4.Encrypt(key, "NV6VVFPoC7FLDlzDUri3qcOAg9cRoFOmsYR9ffDGy5P8HfF6eekX40SFSVfJ1mDb3lcpYRqdg28sp61eHkPukKbqTu1JsVEKiRavi04YtSzUsLXaYSa5BEGwg5G2OF");
to:
Code:
rc4.Encrypt(key, "your special key here");
The key variable is user input.
Problems:
-Dom has told me that my encryption is static, whereas the habbo rc4 encryption wasn't. You can use this for static RC4 encryption if you wish.
Images:
http://i.imgur.com/16TLs.png
Credits:
Jerry Jiang for his RC4.h file :D
~Adil
Re: VL64 and B64 encoding functions ~ C++
Thanks, this will come in handy!
Re: VL64 and B64 encoding functions ~ C++
Better nog make strings of them, bytes are better i guess.
Re: VL64 and B64 encoding functions ~ C++
Ehm I don't know anything about Emulators, what's this?
Re: VL64 and B64 encoding functions ~ C++
Quote:
Originally Posted by
azaidi
Ehm I don't know anything about Emulators, what's this?
It's an encoder/decoder written in C++ :laugh: