nPhoenix

JS ENCRYPT

Apr 24th, 2012
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getletter(num) {
  2.     if (num < 10) {
  3.         return num;
  4.     } else {
  5.         if (num == 10) {
  6.             return "A"
  7.         }
  8.         if (num == 11) {
  9.             return "B"
  10.         }
  11.         if (num == 12) {
  12.             return "C"
  13.         }
  14.         if (num == 13) {
  15.             return "D"
  16.         }
  17.         if (num == 14) {
  18.             return "E"
  19.         }
  20.         if (num == 15) {
  21.             return "F"
  22.         }
  23.     }
  24. };
  25.  
  26. function hexfromdec(num) {
  27.     if (num > 65535) {
  28.         return ("err!")
  29.     }
  30.     first = Math.round(num / 4096 - .5);
  31.     temp1 = num - first * 4096;
  32.     second = Math.round(temp1 / 256 - .5);
  33.     temp2 = temp1 - second * 256;
  34.     third = Math.round(temp2 / 16 - .5);
  35.     fourth = temp2 - third * 16;
  36.     return ("" + getletter(third) + getletter(fourth));
  37. };
  38.  
  39. function encrypt(tx) {
  40.     var hex = '';
  41.     var i;
  42.     for (i = 0; i < tx.length; i++) {
  43.         hex += '%' + hexfromdec(tx.charCodeAt(i));
  44.     };
  45.     return hex;
  46. };
  47. /*
  48. encrypt('SEU TEXTO');
  49. Depois pra usar:
  50. eval(unescape('O QUE APARECEU'));
  51. */
Advertisement
Add Comment
Please, Sign In to add comment