home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Aventura / ninja_nightmare.swf / scripts / DefineSprite_965 / frame_1 / DoAction.as < prev   
Encoding:
Text File  |  2007-03-20  |  4.8 KB  |  162 lines

  1. function rand_str()
  2. {
  3.    var out = "";
  4.    var len = 10;
  5.    var alpha = "abcdefghijklmnopqrstuvwxyz";
  6.    var n = 0;
  7.    while(n < len)
  8.    {
  9.       out += alpha.charAt(Math.floor(Math.random() * alpha.length));
  10.       n++;
  11.    }
  12.    return out;
  13. }
  14. function rhex(num)
  15. {
  16.    str = "";
  17.    j = 0;
  18.    while(j <= 3)
  19.    {
  20.       str += hex_chr.charAt(num >> j * 8 + 4 & 0x0F) + hex_chr.charAt(num >> j * 8 & 0x0F);
  21.       j++;
  22.    }
  23.    return str;
  24. }
  25. function str2blks_MD5(str)
  26. {
  27.    nblk = (str.length + 8 >> 6) + 1;
  28.    blks = new Array(nblk * 16);
  29.    i = 0;
  30.    while(i < nblk * 16)
  31.    {
  32.       blks[i] = 0;
  33.       i++;
  34.    }
  35.    i = 0;
  36.    while(i < str.length)
  37.    {
  38.       blks[i >> 2] |= str.charCodeAt(i) << i % 4 * 8;
  39.       i++;
  40.    }
  41.    blks[i >> 2] |= 128 << i % 4 * 8;
  42.    blks[nblk * 16 - 2] = str.length * 8;
  43.    return blks;
  44. }
  45. function add2(x, y)
  46. {
  47.    var lsw = (x & 0xFFFF) + (y & 0xFFFF);
  48.    var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
  49.    return msw << 16 | lsw & 0xFFFF;
  50. }
  51. function rol(num, cnt)
  52. {
  53.    return num << cnt | num >>> 32 - cnt;
  54. }
  55. function cmn(q, a, b, x, s, t)
  56. {
  57.    return add2(rol(add2(add2(a,q),add2(x,t)),s),b);
  58. }
  59. function ff(a, b, c, d, x, s, t)
  60. {
  61.    return cmn(b & c | (~b) & d,a,b,x,s,t);
  62. }
  63. function gg(a, b, c, d, x, s, t)
  64. {
  65.    return cmn(b & d | c & (~d),a,b,x,s,t);
  66. }
  67. function hh(a, b, c, d, x, s, t)
  68. {
  69.    return cmn(b ^ c ^ d,a,b,x,s,t);
  70. }
  71. function ii(a, b, c, d, x, s, t)
  72. {
  73.    return cmn(c ^ (b | ~d),a,b,x,s,t);
  74. }
  75. function calcMD5(str)
  76. {
  77.    x = str2blks_MD5(str);
  78.    a = 1732584193;
  79.    b = -271733879;
  80.    c = -1732584194;
  81.    d = 271733878;
  82.    i = 0;
  83.    while(i < x.length)
  84.    {
  85.       olda = a;
  86.       oldb = b;
  87.       oldc = c;
  88.       oldd = d;
  89.       a = ff(a,b,c,d,x[i + 0],7,-680876936);
  90.       d = ff(d,a,b,c,x[i + 1],12,-389564586);
  91.       c = ff(c,d,a,b,x[i + 2],17,606105819);
  92.       b = ff(b,c,d,a,x[i + 3],22,-1044525330);
  93.       a = ff(a,b,c,d,x[i + 4],7,-176418897);
  94.       d = ff(d,a,b,c,x[i + 5],12,1200080426);
  95.       c = ff(c,d,a,b,x[i + 6],17,-1473231341);
  96.       b = ff(b,c,d,a,x[i + 7],22,-45705983);
  97.       a = ff(a,b,c,d,x[i + 8],7,1770035416);
  98.       d = ff(d,a,b,c,x[i + 9],12,-1958414417);
  99.       c = ff(c,d,a,b,x[i + 10],17,-42063);
  100.       b = ff(b,c,d,a,x[i + 11],22,-1990404162);
  101.       a = ff(a,b,c,d,x[i + 12],7,1804603682);
  102.       d = ff(d,a,b,c,x[i + 13],12,-40341101);
  103.       c = ff(c,d,a,b,x[i + 14],17,-1502002290);
  104.       b = ff(b,c,d,a,x[i + 15],22,1236535329);
  105.       a = gg(a,b,c,d,x[i + 1],5,-165796510);
  106.       d = gg(d,a,b,c,x[i + 6],9,-1069501632);
  107.       c = gg(c,d,a,b,x[i + 11],14,643717713);
  108.       b = gg(b,c,d,a,x[i + 0],20,-373897302);
  109.       a = gg(a,b,c,d,x[i + 5],5,-701558691);
  110.       d = gg(d,a,b,c,x[i + 10],9,38016083);
  111.       c = gg(c,d,a,b,x[i + 15],14,-660478335);
  112.       b = gg(b,c,d,a,x[i + 4],20,-405537848);
  113.       a = gg(a,b,c,d,x[i + 9],5,568446438);
  114.       d = gg(d,a,b,c,x[i + 14],9,-1019803690);
  115.       c = gg(c,d,a,b,x[i + 3],14,-187363961);
  116.       b = gg(b,c,d,a,x[i + 8],20,1163531501);
  117.       a = gg(a,b,c,d,x[i + 13],5,-1444681467);
  118.       d = gg(d,a,b,c,x[i + 2],9,-51403784);
  119.       c = gg(c,d,a,b,x[i + 7],14,1735328473);
  120.       b = gg(b,c,d,a,x[i + 12],20,-1926607734);
  121.       a = hh(a,b,c,d,x[i + 5],4,-378558);
  122.       d = hh(d,a,b,c,x[i + 8],11,-2022574463);
  123.       c = hh(c,d,a,b,x[i + 11],16,1839030562);
  124.       b = hh(b,c,d,a,x[i + 14],23,-35309556);
  125.       a = hh(a,b,c,d,x[i + 1],4,-1530992060);
  126.       d = hh(d,a,b,c,x[i + 4],11,1272893353);
  127.       c = hh(c,d,a,b,x[i + 7],16,-155497632);
  128.       b = hh(b,c,d,a,x[i + 10],23,-1094730640);
  129.       a = hh(a,b,c,d,x[i + 13],4,681279174);
  130.       d = hh(d,a,b,c,x[i + 0],11,-358537222);
  131.       c = hh(c,d,a,b,x[i + 3],16,-722521979);
  132.       b = hh(b,c,d,a,x[i + 6],23,76029189);
  133.       a = hh(a,b,c,d,x[i + 9],4,-640364487);
  134.       d = hh(d,a,b,c,x[i + 12],11,-421815835);
  135.       c = hh(c,d,a,b,x[i + 15],16,530742520);
  136.       b = hh(b,c,d,a,x[i + 2],23,-995338651);
  137.       a = ii(a,b,c,d,x[i + 0],6,-198630844);
  138.       d = ii(d,a,b,c,x[i + 7],10,1126891415);
  139.       c = ii(c,d,a,b,x[i + 14],15,-1416354905);
  140.       b = ii(b,c,d,a,x[i + 5],21,-57434055);
  141.       a = ii(a,b,c,d,x[i + 12],6,1700485571);
  142.       d = ii(d,a,b,c,x[i + 3],10,-1894986606);
  143.       c = ii(c,d,a,b,x[i + 10],15,-1051523);
  144.       b = ii(b,c,d,a,x[i + 1],21,-2054922799);
  145.       a = ii(a,b,c,d,x[i + 8],6,1873313359);
  146.       d = ii(d,a,b,c,x[i + 15],10,-30611744);
  147.       c = ii(c,d,a,b,x[i + 6],15,-1560198380);
  148.       b = ii(b,c,d,a,x[i + 13],21,1309151649);
  149.       a = ii(a,b,c,d,x[i + 4],6,-145523070);
  150.       d = ii(d,a,b,c,x[i + 11],10,-1120210379);
  151.       c = ii(c,d,a,b,x[i + 2],15,718787259);
  152.       b = ii(b,c,d,a,x[i + 9],21,-343485551);
  153.       a = add2(a,olda);
  154.       b = add2(b,oldb);
  155.       c = add2(c,oldc);
  156.       d = add2(d,oldd);
  157.       i += 16;
  158.    }
  159.    return rhex(a) + rhex(b) + rhex(c) + rhex(d);
  160. }
  161. var hex_chr = "0123456789abcdef";
  162.