B64 & VL64 Javascript implementation

Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    Valued Member Shynoshy is offline
    MemberRank
    Jun 2007 Join Date
    103Posts

    B64 & VL64 Javascript implementation

    Hello RaGEZONE !

    I just finished my own implementation of B64 & VL64 encoding/decoding in Javascript using NodeJS API. I tried to keep this compatible with browsers, but i didn't tested it browser-side.

    You can use this in a browser (but it's not really recommended, i know that NodeJS is using V8 engine by Google implemented in Google Chrome, but untested work with Gecko engine by Mozilla ).

    Anyway, this is the snippet.

    Code:
    /*
    ** Habbo Encoding/Decoding - NodeJS implementation
    **
    ** Can crash if used in browsers :
    ** -- Add parenthesis around control structures then it will work.
    */
    
    
    /*
    ** "Base" 64 - Working with array faster than string
    */
    
    
    function encodeB64(number) {
      var buff = ['@', '@'];
      for (var i = 0; number > 0; ++i, number = Math.floor(number / 64))
        buff[i] = String.fromCharCode((number % 64) + 64);
      return buff.reverse().join('');
    }
    
    
    function decodeB64(str) {
      var nb = 0;
      for (var i = (str.length - 1), j = 0; i >= 0; --i, ++j)
        nb += (str.charCodeAt(i) - 64) * Math.pow(64, j);
      return nb;
    }
    
    
    /*
    ** VL64
    */
    
    
    function encodeVl64(number) {
      var str = [];
      var i = 1;
      var absolute = Math.abs(number) >> 2;
    
    
      for (; absolute > 0; absolute >>= 6, ++i)
        str[i] = String.fromCharCode(64 | (absolute & 63));
      str[0] = String.fromCharCode(64 | i << 3 | (number <= 0 ? 1 : 0) << 2 | (Math.abs(number) & 3));
      return str.join('');
    }
    
    
    function decodeVl64(str) {
      var ret = 0;
      var ctrl = ((str.charCodeAt(0) - 64) >> 2);
      var bytes = ((ctrl >> 1) - 1);
    
    
      for (; bytes > 0; --bytes && (ret <<= 6))
        ret += (str.charCodeAt(bytes) & 63);
      ret = (ret << 2) + ((str.charCodeAt(0) - 64) & 3);
      if (ctrl & 1)
        ret *= -1;
      return ret;
    }
    I know this is more for old-servers, but i'm a old server fan and i hate crappy-flash new versions.

    I hope you a lot of fun with this. Be creative. NodeJS can do A LOT more than you can think ;)
    Cya !
    Last edited by Shynoshy; 25-06-13 at 08:59 AM.


  2. #2
    Zephyr Studios PRIZM is offline
    MemberRank
    Feb 2012 Join Date
    DenmarkLocation
    2,291Posts

    Re: B64 & VL64 Javascript implementation

    Welcome back, I like when someone comes back because so many in the Habbo Hotel section has left. :(

    Can you tell me more specific what this does is used to?

  3. #3
    Valued Member Shynoshy is offline
    MemberRank
    Jun 2007 Join Date
    103Posts

    Re: B64 & VL64 Javascript implementation

    Well, you can use it to create an emulator in NodeJS (and maybe Vert.x) or in a Javascript Habbo handmade client (like Jabbo for example) in order to encode/decode packets.

    Or you can simply do a "Nillus Packet Scout" web version ... As you want !
    Last edited by Shynoshy; 25-06-13 at 09:00 AM.

  4. #4
    Check http://arcturus.pw The General is offline
    DeveloperRank
    Aug 2011 Join Date
    7,610Posts

    Re: B64 & VL64 Javascript implementation

    Quote Originally Posted by PRIZM View Post
    Welcome back, I like when someone comes back because so many in the Habbo Hotel section has left. :(

    Can you tell me more specific what this does is used to?
    Seems like you dont know what B64 and VL64 is.
    It is just a encryption method like md5 however this can be reversed and was used in the oldskool packet system.

  5. #5
    Developer BurakDev is offline
    MemberRank
    Mar 2013 Join Date
    ParisLocation
    376Posts

    Re: B64 & VL64 Javascript implementation

    Nice release but b64 & vl64 is don't used in new release. (new encoding)

  6. #6
    Valued Member Shynoshy is offline
    MemberRank
    Jun 2007 Join Date
    103Posts

    Re: B64 & VL64 Javascript implementation

    Quote Originally Posted by BurakDev
    Nice release but b64 & vl64 is don't used in new release. (new encoding)
    Quote Originally Posted by Shynoshy View Post
    I know this is more for old-servers, but i'm a old server fan and i hate crappy-flash new versions.
    Thanks Burak, as always, very pertinent remarks and a full reading of the main message.

  7. #7
    Developer BurakDev is offline
    MemberRank
    Mar 2013 Join Date
    ParisLocation
    376Posts

    Re: B64 & VL64 Javascript implementation

    Quote Originally Posted by Shynoshy View Post
    Thanks Burak, as always, very pertinent remarks and a full reading of the main message.
    I just say if you want make emulator, make new encoding in Javascript :)

  8. #8
    Valued Member Shynoshy is offline
    MemberRank
    Jun 2007 Join Date
    103Posts

    Re: B64 & VL64 Javascript implementation

    Yes, i could, like i did here. I didn't just adapt functions, i also created algorythm by understanding how really those works and using the possibilities of Javascript NodeJS API.

    The main point is that i don't care about new emulators / Flash Habbo, and i don't really care about Habbo anymore, also said on my first message ...
    Last edited by Shynoshy; 25-06-13 at 09:01 AM.

  9. #9
    ☮TAKU???? seanrom is offline
    MemberRank
    Nov 2009 Join Date
    1,004Posts

    Re: B64 & VL64 Javascript implementation

    Okay, what in seven hells does this have anything todo with Habbo?
    Try Coders' Paradise /f144/

  10. #10
    I don't even know azaidi is offline
    MemberRank
    Apr 2010 Join Date
    the NetherlandsLocation
    2,065Posts

    Re: B64 & VL64 Javascript implementation

    Quote Originally Posted by Zensai View Post
    Okay, what in seven hells does this have anything todo with Habbo?
    Try Coders' Paradise /f144/
    Because this isn't the real Base64 but a Habbo-edited version?

  11. #11
    Apprentice Mojo Jojo is offline
    MemberRank
    May 2013 Join Date
    7Posts

    Re: B64 & VL64 Javascript implementation

    Quote Originally Posted by Shynoshy View Post
    Well, you can use it to create an emulator in NodeJS (and maybe Vert.x) or in a Javascript Habbo handmade client (like Jabbo for example) in order to encrypt/decrypt packets.

    Or you can simply do a "Nillus Packet Scout" web version ... As you want !
    It's not Encryption / Decryption. It's ENCODING. Base64 or "B64" is used to identify packet headers via encoded integer ID's. Base64 means that you use 64 different characters to represent numbers, like in Binary you only use 1's and 0's, Binary is "Base 2", Decimal is "Base 10", Hex is "Base 16". You need Base 64 Encoding because you cannot just send integers mixed in with other integers, you have an integer identifying the header's ID, what it represents, and telling the client or server how it's meant to be interpreted.

    Then you have to send large integers with strings in other bodies of packets, so you encode those, but wouldn't it be confusing if you decode Base 64 encoded integers twice, that's why VL64 encoding was brought in. So you have encoding for the headers, and then you have encoding for regular integers (e.g. number of Credits). The Encryption, is RC4. I wish people would stop mixing up encoding and encryption, it's not that complicated, these encoding algorithms take letters and symbols and represent numbers with them, in Hexadecimal you use letters to count beyond "10" (in Decimal form), instead you use 'A' (Hexadecimal) to represent "10" (decimal).

    Further reading:
    Base64 - Wikipedia, the free encyclopedia
    http://forum.ragezone.com/f331/guide...ctions-477478/

    Quote Originally Posted by Zensai View Post
    Okay, what in seven hells does this have anything todo with Habbo?
    Try Coders' Paradise /f144/
    This has everything to do with Habbo. From version 7 of Habbo all the way to some revision of Release 63 ('R63') this has been the protocol used to develop habbo emulators. Don't speak if you don't know what you're talking about. This person took the liberty of porting this to JavaScript for NodeJS which can be used to power servers, so you could code a whole Habbo emulator in pure JavaScript for the older versions of Habbo, and run it behind a powerful JavaScript engine.

  12. #12
    ☮TAKU???? seanrom is offline
    MemberRank
    Nov 2009 Join Date
    1,004Posts

    Re: B64 & VL64 Javascript implementation

    Quote Originally Posted by Mojo Jojo View Post
    It's not Encryption / Decryption. It's ENCODING. Base64 or "B64" is used to identify packet headers via encoded integer ID's. Base64 means that you use 64 different characters to represent numbers, like in Binary you only use 1's and 0's, Binary is "Base 2", Decimal is "Base 10", Hex is "Base 16". You need Base 64 Encoding because you cannot just send integers mixed in with other integers, you have an integer identifying the header's ID, what it represents, and telling the client or server how it's meant to be interpreted.

    Then you have to send large integers with strings in other bodies of packets, so you encode those, but wouldn't it be confusing if you decode Base 64 encoded integers twice, that's why VL64 encoding was brought in. So you have encoding for the headers, and then you have encoding for regular integers (e.g. number of Credits). The Encryption, is RC4. I wish people would stop mixing up encoding and encryption, it's not that complicated, these encoding algorithms take letters and symbols and represent numbers with them, in Hexadecimal you use letters to count beyond "10" (in Decimal form), instead you use 'A' (Hexadecimal) to represent "10" (decimal).

    Further reading:
    Base64 - Wikipedia, the free encyclopedia
    http://forum.ragezone.com/f331/guide...ctions-477478/



    This has everything to do with Habbo. From version 7 of Habbo all the way to some revision of Release 63 ('R63') this has been the protocol used to develop habbo emulators. Don't speak if you don't know what you're talking about. This person took the liberty of porting this to JavaScript for NodeJS which can be used to power servers, so you could code a whole Habbo emulator in pure JavaScript for the older versions of Habbo, and run it behind a powerful JavaScript engine.
    I did understand that, made a post about it but it got removed by a moderator for unknown reason.
    Good post btw

  13. #13
    Valued Member Shynoshy is offline
    MemberRank
    Jun 2007 Join Date
    103Posts

    Re: B64 & VL64 Javascript implementation

    Quote Originally Posted by Mojo Jojo View Post
    It's not Encryption / Decryption. It's ENCODING. Base64 or "B64" is used to identify packet headers via encoded integer ID's. Base64 means that you use 64 different characters to represent numbers, like in Binary you only use 1's and 0's, Binary is "Base 2", Decimal is "Base 10", Hex is "Base 16". You need Base 64 Encoding because you cannot just send integers mixed in with other integers, you have an integer identifying the header's ID, what it represents, and telling the client or server how it's meant to be interpreted.

    Then you have to send large integers with strings in other bodies of packets, so you encode those, but wouldn't it be confusing if you decode Base 64 encoded integers twice, that's why VL64 encoding was brought in. So you have encoding for the headers, and then you have encoding for regular integers (e.g. number of Credits). The Encryption, is RC4. I wish people would stop mixing up encoding and encryption, it's not that complicated, these encoding algorithms take letters and symbols and represent numbers with them, in Hexadecimal you use letters to count beyond "10" (in Decimal form), instead you use 'A' (Hexadecimal) to represent "10" (decimal).
    Agree, sorry for that misnoming. I will edit my post.

  14. #14
    Alpha Member Emily is offline
    MemberRank
    Oct 2012 Join Date
    The NetherlandsLocation
    2,408Posts

    Re: B64 & VL64 Javascript implementation

    Quote Originally Posted by Mojo Jojo View Post
    It's not Encryption / Decryption. It's ENCODING. Base64 or "B64" is used to identify packet headers via encoded integer ID's. Base64 means that you use 64 different characters to represent numbers, like in Binary you only use 1's and 0's, Binary is "Base 2", Decimal is "Base 10", Hex is "Base 16". You need Base 64 Encoding because you cannot just send integers mixed in with other integers, you have an integer identifying the header's ID, what it represents, and telling the client or server how it's meant to be interpreted.

    Then you have to send large integers with strings in other bodies of packets, so you encode those, but wouldn't it be confusing if you decode Base 64 encoded integers twice, that's why VL64 encoding was brought in. So you have encoding for the headers, and then you have encoding for regular integers (e.g. number of Credits). The Encryption, is RC4. I wish people would stop mixing up encoding and encryption, it's not that complicated, these encoding algorithms take letters and symbols and represent numbers with them, in Hexadecimal you use letters to count beyond "10" (in Decimal form), instead you use 'A' (Hexadecimal) to represent "10" (decimal).

    Further reading:
    Base64 - Wikipedia, the free encyclopedia
    http://forum.ragezone.com/f331/guide...ctions-477478/



    This has everything to do with Habbo. From version 7 of Habbo all the way to some revision of Release 63 ('R63') this has been the protocol used to develop habbo emulators. Don't speak if you don't know what you're talking about. This person took the liberty of porting this to JavaScript for NodeJS which can be used to power servers, so you could code a whole Habbo emulator in pure JavaScript for the older versions of Habbo, and run it behind a powerful JavaScript engine.
    Encryption is not JUST RC4, but is RC1, RC2, RC3, RC4 etc.. DiffieHellman, RSA and a lot of other algorithms.

  15. #15
    Live Ocottish Sverlord Joopie is online now
    LegendRank
    Jun 2010 Join Date
    The NetherlandsLocation
    2,773Posts

    Re: B64 & VL64 Javascript implementation

    Quote Originally Posted by Tha View Post
    Encryption is not JUST RC4, but is RC1, RC2, RC3, RC4 etc.. DiffieHellman, RSA and a lot of other algorithms.
    Funny how you call DiffieHellman an "encryption"



Page 1 of 2 12 LastLast

Advertisement