Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function encode(opString)
  2. {
  3.     opString != undefined ? (str = opString) : (str = str);
  4.     var _loc3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  5.     var _loc1;
  6.     var _loc5;
  7.     var _loc2 = 0;
  8.     for (var _loc4 = ""; str.length >= _loc2 + 3; _loc4 = _loc4 + (_loc3.charAt((_loc1 & 16515072) >> 18) + _loc3.charAt((_loc1 & 258048) >> 12) + _loc3.charAt((_loc1 & 4032) >> 6) + _loc3.charAt(_loc1 & 63)))
  9.     {
  10.         _loc1 = (str.charCodeAt(_loc2++) & 255) << 16 | (str.charCodeAt(_loc2++) & 255) << 8 | str.charCodeAt(_loc2++) & 255;
  11.     } // end of for
  12.     if (str.length - _loc2 > 0 && str.length - _loc2 < 3)
  13.     {
  14.         _loc5 = Boolean(str.length - _loc2 - 1);
  15.         _loc1 = (str.charCodeAt(_loc2++) & 255) << 16 | (_loc5 ? ((str.charCodeAt(_loc2) & 255) << 8) : (0));
  16.         _loc4 = _loc4 + (_loc3.charAt((_loc1 & 16515072) >> 18) + _loc3.charAt((_loc1 & 258048) >> 12) + (_loc5 ? (_loc3.charAt((_loc1 & 4032) >> 6)) : ("=")) + "=");
  17.     } // end if
  18.     return (_loc4);
  19. } // End of the function
  20.  
  21. encode("{\"login\":\"login\",\"pass\":\"pass\",\"server\":\"127.0.0.1\"}");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement