b2evolution PHP Cross Reference Blogging Systems

Source: /rsc/js/sha1_md5.js - 583 lines - 18027 bytes - Summary - Text - Print

   1  /* ------------------------- sha1.js ------------------------- */

   2  /*

   3   * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined

   4   * in FIPS 180-1

   5   * Version 2.2-alpha Copyright Paul Johnston 2000 - 2002.

   6   * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet

   7   * Distributed under the BSD License

   8   * See http://pajhome.org.uk/crypt/md5 for details.

   9   */
  10  
  11  /*

  12   * Configurable variables. You may need to tweak these to be compatible with

  13   * the server-side, but the defaults work in most cases.

  14   */
  15  var hexcase = 0;  /* hex output format. 0 - lowercase; 1 - uppercase        */
  16  var b64pad  = ""; /* base-64 pad character. "=" for strict RFC compliance   */
  17  
  18  /*

  19   * These are the functions you'll usually want to call

  20   * They take string arguments and return either hex or base-64 encoded strings

  21   */
  22  function hex_sha1(s)    { return rstr2hex(rstr_sha1(str2rstr_utf8(s))); }
  23  function b64_sha1(s)    { return rstr2b64(rstr_sha1(str2rstr_utf8(s))); }
  24  function any_sha1(s, e) { return rstr2any_sha1(rstr_sha1(str2rstr_utf8(s)), e); }
  25  function hex_hmac_sha1(k, d)
  26    { return rstr2hex(rstr_hmac_sha1(str2rstr_utf8(k), str2rstr_utf8(d))); }
  27  function b64_hmac_sha1(k, d)
  28    { return rstr2b64(rstr_hmac_sha1(str2rstr_utf8(k), str2rstr_utf8(d))); }
  29  function any_hmac_sha1(k, d, e)
  30    { return rstr2any_sha1(rstr_hmac_sha1(str2rstr_utf8(k), str2rstr_utf8(d)), e); }
  31  
  32  /*

  33   * Perform a simple self-test to see if the VM is working

  34   */
  35  function sha1_vm_test()
  36  {
  37    return hex_sha1("abc") == "a9993e364706816aba3e25717850c26c9cd0d89d";
  38  }
  39  
  40  /*

  41   * Calculate the SHA1 of a raw string

  42   */
  43  function rstr_sha1(s)
  44  {
  45    return binb2rstr(binb_sha1(rstr2binb(s), s.length * 8));
  46  }
  47  
  48  /*

  49   * Calculate the HMAC-SHA1 of a key and some data (raw strings)

  50   */
  51  function rstr_hmac_sha1(key, data)
  52  {
  53    var bkey = rstr2binb(key);
  54    if(bkey.length > 16) bkey = binb_sha1(bkey, key.length * 8);
  55  
  56    var ipad = Array(16), opad = Array(16);
  57    for(var i = 0; i < 16; i++)
  58    {
  59      ipad[i] = bkey[i] ^ 0x36363636;
  60      opad[i] = bkey[i] ^ 0x5C5C5C5C;
  61    }
  62  
  63    var hash = binb_sha1(ipad.concat(rstr2binb(data)), 512 + data.length * 8);
  64    return binb2rstr(binb_sha1(opad.concat(hash), 512 + 160));
  65  }
  66  
  67  /*

  68   * Convert a raw string to a hex string

  69   */
  70  function rstr2hex(input)
  71  {
  72    var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
  73    var output = "";
  74    var x;
  75    for(var i = 0; i < input.length; i++)
  76    {
  77      x = input.charCodeAt(i);
  78      output += hex_tab.charAt((x >>> 4) & 0x0F)
  79             +  hex_tab.charAt( x        & 0x0F);
  80    }
  81    return output;
  82  }
  83  
  84  /*

  85   * Convert a raw string to a base-64 string

  86   */
  87  function rstr2b64(input)
  88  {
  89    var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  90    var output = "";
  91    var len = input.length;
  92    for(var i = 0; i < len; i += 3)
  93    {
  94      var triplet = (input.charCodeAt(i) << 16)
  95                  | (i + 1 < len ? input.charCodeAt(i+1) << 8 : 0)
  96                  | (i + 2 < len ? input.charCodeAt(i+2)      : 0);
  97      for(var j = 0; j < 4; j++)
  98      {
  99        if(i * 8 + j * 6 > input.length * 8) output += b64pad;
 100        else output += tab.charAt((triplet >>> 6*(3-j)) & 0x3F);
 101      }
 102    }
 103    return output;
 104  }
 105  
 106  /*

 107   * Convert a raw string to an arbitrary string encoding

 108   */
 109  function rstr2any_sha1(input, encoding)
 110  {
 111    var divisor = encoding.length;
 112    var remainders = Array();
 113    var i, q, x, quotient;
 114  
 115    /* Convert to an array of 16-bit big-endian values, forming the dividend */

 116    var dividend = Array(Math.ceil(input.length / 2));
 117    for(i = 0; i < dividend.length; i++)
 118    {
 119      dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1);
 120    }
 121  
 122    /*

 123     * Repeatedly perform a long division. The binary array forms the dividend,

 124     * the length of the encoding is the divisor. Once computed, the quotient

 125     * forms the dividend for the next step. We stop when the dividend is zero.

 126     * All remainders are stored for later use.

 127     */
 128    while(dividend.length > 0)
 129    {
 130      quotient = Array();
 131      x = 0;
 132      for(i = 0; i < dividend.length; i++)
 133      {
 134        x = (x << 16) + dividend[i];
 135        q = Math.floor(x / divisor);
 136        x -= q * divisor;
 137        if(quotient.length > 0 || q > 0)
 138          quotient[quotient.length] = q;
 139      }
 140      remainders[remainders.length] = x;
 141      dividend = quotient;
 142    }
 143  
 144    /* Convert the remainders to the output string */

 145    var output = "";
 146    for(i = remainders.length - 1; i >= 0; i--)
 147      output += encoding.charAt(remainders[i]);
 148  
 149    /* Append leading zero equivalents */

 150    var full_length = Math.ceil(input.length * 8 /
 151                                      (Math.log(encoding.length) / Math.log(2)))
 152    for(i = output.length; i < full_length; i++)
 153      output = encoding[0] + output;
 154  
 155    return output;
 156  }
 157  
 158  /*

 159   * Encode a string as utf-8.

 160   * For efficiency, this assumes the input is valid utf-16.

 161   */
 162  function str2rstr_utf8(input)
 163  {
 164    var output = "";
 165    var i = -1;
 166    var x, y;
 167  
 168    while(++i < input.length)
 169    {
 170      /* Decode utf-16 surrogate pairs */

 171      x = input.charCodeAt(i);
 172      y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0;
 173      if(0xD800 <= x && x <= 0xDBFF && 0xDC00 <= y && y <= 0xDFFF)
 174      {
 175        x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF);
 176        i++;
 177      }
 178  
 179      /* Encode output as utf-8 */

 180      if(x <= 0x7F)
 181        output += String.fromCharCode(x);
 182      else if(x <= 0x7FF)
 183        output += String.fromCharCode(0xC0 | ((x >>> 6 ) & 0x1F),
 184                                      0x80 | ( x         & 0x3F));
 185      else if(x <= 0xFFFF)
 186        output += String.fromCharCode(0xE0 | ((x >>> 12) & 0x0F),
 187                                      0x80 | ((x >>> 6 ) & 0x3F),
 188                                      0x80 | ( x         & 0x3F));
 189      else if(x <= 0x1FFFFF)
 190        output += String.fromCharCode(0xF0 | ((x >>> 18) & 0x07),
 191                                      0x80 | ((x >>> 12) & 0x3F),
 192                                      0x80 | ((x >>> 6 ) & 0x3F),
 193                                      0x80 | ( x         & 0x3F));
 194    }
 195    return output;
 196  }
 197  
 198  /*

 199   * Encode a string as utf-16

 200   */
 201  function str2rstr_utf16le(input)
 202  {
 203    var output = "";
 204    for(var i = 0; i < input.length; i++)
 205      output += String.fromCharCode( input.charCodeAt(i)        & 0xFF,
 206                                    (input.charCodeAt(i) >>> 8) & 0xFF);
 207    return output;
 208  }
 209  
 210  function str2rstr_utf16be(input)
 211  {
 212    var output = "";
 213    for(var i = 0; i < input.length; i++)
 214      output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF,
 215                                     input.charCodeAt(i)        & 0xFF);
 216    return output;
 217  }
 218  
 219  /*

 220   * Convert a raw string to an array of big-endian words

 221   * Characters >255 have their high-byte silently ignored.

 222   */
 223  function rstr2binb(input)
 224  {
 225    var output = Array(input.length >> 2);
 226    for(var i = 0; i < output.length; i++)
 227      output[i] = 0;
 228    for(var i = 0; i < input.length * 8; i += 8)
 229      output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (24 - i % 32);
 230    return output;
 231  }
 232  
 233  /*

 234   * Convert an array of little-endian words to a string

 235   */
 236  function binb2rstr(input)
 237  {
 238    var output = "";
 239    for(var i = 0; i < input.length * 32; i += 8)
 240      output += String.fromCharCode((input[i>>5] >>> (24 - i % 32)) & 0xFF);
 241    return output;
 242  }
 243  
 244  /*

 245   * Calculate the SHA-1 of an array of big-endian words, and a bit length

 246   */
 247  function binb_sha1(x, len)
 248  {
 249    /* append padding */

 250    x[len >> 5] |= 0x80 << (24 - len % 32);
 251    x[((len + 64 >> 9) << 4) + 15] = len;
 252  
 253    var w = Array(80);
 254    var a =  1732584193;
 255    var b = -271733879;
 256    var c = -1732584194;
 257    var d =  271733878;
 258    var e = -1009589776;
 259  
 260    for(var i = 0; i < x.length; i += 16)
 261    {
 262      var olda = a;
 263      var oldb = b;
 264      var oldc = c;
 265      var oldd = d;
 266      var olde = e;
 267  
 268      for(var j = 0; j < 80; j++)
 269      {
 270        if(j < 16) w[j] = x[i + j];
 271        else w[j] = bit_rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1);
 272        var t = safe_add(safe_add(bit_rol(a, 5), sha1_ft(j, b, c, d)),
 273                         safe_add(safe_add(e, w[j]), sha1_kt(j)));
 274        e = d;
 275        d = c;
 276        c = bit_rol(b, 30);
 277        b = a;
 278        a = t;
 279      }
 280  
 281      a = safe_add(a, olda);
 282      b = safe_add(b, oldb);
 283      c = safe_add(c, oldc);
 284      d = safe_add(d, oldd);
 285      e = safe_add(e, olde);
 286    }
 287    return Array(a, b, c, d, e);
 288  
 289  }
 290  
 291  /*

 292   * Perform the appropriate triplet combination function for the current

 293   * iteration

 294   */
 295  function sha1_ft(t, b, c, d)
 296  {
 297    if(t < 20) return (b & c) | ((~b) & d);
 298    if(t < 40) return b ^ c ^ d;
 299    if(t < 60) return (b & c) | (b & d) | (c & d);
 300    return b ^ c ^ d;
 301  }
 302  
 303  /*

 304   * Determine the appropriate additive constant for the current iteration

 305   */
 306  function sha1_kt(t)
 307  {
 308    return (t < 20) ?  1518500249 : (t < 40) ?  1859775393 :
 309           (t < 60) ? -1894007588 : -899497514;
 310  }
 311  
 312  /*

 313   * Add integers, wrapping at 2^32. This uses 16-bit operations internally

 314   * to work around bugs in some JS interpreters.

 315   */
 316  function safe_add(x, y)
 317  {
 318    var lsw = (x & 0xFFFF) + (y & 0xFFFF);
 319    var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
 320    return (msw << 16) | (lsw & 0xFFFF);
 321  }
 322  
 323  /*

 324   * Bitwise rotate a 32-bit number to the left.

 325   */
 326  function bit_rol(num, cnt)
 327  {
 328    return (num << cnt) | (num >>> (32 - cnt));
 329  }
 330  
 331  
 332  /* ------------------------- md5.js ------------------------- */

 333  /*

 334   * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message

 335   * Digest Algorithm, as defined in RFC 1321.

 336   * Version 2.2-alpha Copyright (C) Paul Johnston 1999 - 2005

 337   * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet

 338   * Distributed under the BSD License

 339   * See http://pajhome.org.uk/crypt/md5 for more info.

 340   */
 341  
 342  /*

 343   * These are the functions you'll usually want to call

 344   * They take string arguments and return either hex or base-64 encoded strings

 345   */
 346  function hex_md5(s)    { return rstr2hex(rstr_md5(str2rstr_utf8(s))); }
 347  function b64_md5(s)    { return rstr2b64(rstr_md5(str2rstr_utf8(s))); }
 348  function any_md5(s, e) { return rstr2any_md5(rstr_md5(str2rstr_utf8(s)), e); }
 349  function hex_hmac_md5(k, d)
 350    { return rstr2hex(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d))); }
 351  function b64_hmac_md5(k, d)
 352    { return rstr2b64(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d))); }
 353  function any_hmac_md5(k, d, e)
 354    { return rstr2any_md5(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d)), e); }
 355  
 356  /*

 357   * Perform a simple self-test to see if the VM is working

 358   */
 359  function md5_vm_test()
 360  {
 361    return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
 362  }
 363  
 364  /*

 365   * Calculate the MD5 of a raw string

 366   */
 367  function rstr_md5(s)
 368  {
 369    return binl2rstr(binl_md5(rstr2binl(s), s.length * 8));
 370  }
 371  
 372  /*

 373   * Calculate the HMAC-MD5, of a key and some data (raw strings)

 374   */
 375  function rstr_hmac_md5(key, data)
 376  {
 377    var bkey = rstr2binl(key);
 378    if(bkey.length > 16) bkey = binl_md5(bkey, key.length * 8);
 379  
 380    var ipad = Array(16), opad = Array(16);
 381    for(var i = 0; i < 16; i++)
 382    {
 383      ipad[i] = bkey[i] ^ 0x36363636;
 384      opad[i] = bkey[i] ^ 0x5C5C5C5C;
 385    }
 386  
 387    var hash = binl_md5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);
 388    return binl2rstr(binl_md5(opad.concat(hash), 512 + 128));
 389  }
 390  
 391  /*

 392   * Convert a raw string to an arbitrary string encoding

 393   */
 394  function rstr2any_md5(input, encoding)
 395  {
 396    var divisor = encoding.length;
 397    var i, j, q, x, quotient;
 398  
 399    /* Convert to an array of 16-bit big-endian values, forming the dividend */

 400    var dividend = Array(Math.ceil(input.length / 2));
 401    for(i = 0; i < dividend.length; i++)
 402    {
 403      dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1);
 404    }
 405  
 406    /*

 407     * Repeatedly perform a long division. The binary array forms the dividend,

 408     * the length of the encoding is the divisor. Once computed, the quotient

 409     * forms the dividend for the next step. All remainders are stored for later

 410     * use.

 411     */
 412    var full_length = Math.ceil(input.length * 8 /
 413                                      (Math.log(encoding.length) / Math.log(2)));
 414    var remainders = Array(full_length);
 415    for(j = 0; j < full_length; j++)
 416    {
 417      quotient = Array();
 418      x = 0;
 419      for(i = 0; i < dividend.length; i++)
 420      {
 421        x = (x << 16) + dividend[i];
 422        q = Math.floor(x / divisor);
 423        x -= q * divisor;
 424        if(quotient.length > 0 || q > 0)
 425          quotient[quotient.length] = q;
 426      }
 427      remainders[j] = x;
 428      dividend = quotient;
 429    }
 430  
 431    /* Convert the remainders to the output string */

 432    var output = "";
 433    for(i = remainders.length - 1; i >= 0; i--)
 434      output += encoding.charAt(remainders[i]);
 435  
 436    return output;
 437  }
 438  
 439  /*

 440   * Convert a raw string to an array of little-endian words

 441   * Characters >255 have their high-byte silently ignored.

 442   */
 443  function rstr2binl(input)
 444  {
 445    var output = Array(input.length >> 2);
 446    for(var i = 0; i < output.length; i++)
 447      output[i] = 0;
 448    for(var i = 0; i < input.length * 8; i += 8)
 449      output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (i%32);
 450    return output;
 451  }
 452  
 453  /*

 454   * Convert an array of little-endian words to a string

 455   */
 456  function binl2rstr(input)
 457  {
 458    var output = "";
 459    for(var i = 0; i < input.length * 32; i += 8)
 460      output += String.fromCharCode((input[i>>5] >>> (i % 32)) & 0xFF);
 461    return output;
 462  }
 463  
 464  /*

 465   * Calculate the MD5 of an array of little-endian words, and a bit length.

 466   */
 467  function binl_md5(x, len)
 468  {
 469    /* append padding */

 470    x[len >> 5] |= 0x80 << ((len) % 32);
 471    x[(((len + 64) >>> 9) << 4) + 14] = len;
 472  
 473    var a =  1732584193;
 474    var b = -271733879;
 475    var c = -1732584194;
 476    var d =  271733878;
 477  
 478    for(var i = 0; i < x.length; i += 16)
 479    {
 480      var olda = a;
 481      var oldb = b;
 482      var oldc = c;
 483      var oldd = d;
 484  
 485      a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
 486      d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
 487      c = md5_ff(c, d, a, b, x[i+ 2], 17,  606105819);
 488      b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
 489      a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
 490      d = md5_ff(d, a, b, c, x[i+ 5], 12,  1200080426);
 491      c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
 492      b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
 493      a = md5_ff(a, b, c, d, x[i+ 8], 7 ,  1770035416);
 494      d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
 495      c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
 496      b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
 497      a = md5_ff(a, b, c, d, x[i+12], 7 ,  1804603682);
 498      d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
 499      c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
 500      b = md5_ff(b, c, d, a, x[i+15], 22,  1236535329);
 501  
 502      a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
 503      d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
 504      c = md5_gg(c, d, a, b, x[i+11], 14,  643717713);
 505      b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
 506      a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
 507      d = md5_gg(d, a, b, c, x[i+10], 9 ,  38016083);
 508      c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
 509      b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
 510      a = md5_gg(a, b, c, d, x[i+ 9], 5 ,  568446438);
 511      d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
 512      c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
 513      b = md5_gg(b, c, d, a, x[i+ 8], 20,  1163531501);
 514      a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
 515      d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
 516      c = md5_gg(c, d, a, b, x[i+ 7], 14,  1735328473);
 517      b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
 518  
 519      a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
 520      d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
 521      c = md5_hh(c, d, a, b, x[i+11], 16,  1839030562);
 522      b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
 523      a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
 524      d = md5_hh(d, a, b, c, x[i+ 4], 11,  1272893353);
 525      c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
 526      b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
 527      a = md5_hh(a, b, c, d, x[i+13], 4 ,  681279174);
 528      d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
 529      c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
 530      b = md5_hh(b, c, d, a, x[i+ 6], 23,  76029189);
 531      a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
 532      d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
 533      c = md5_hh(c, d, a, b, x[i+15], 16,  530742520);
 534      b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
 535  
 536      a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
 537      d = md5_ii(d, a, b, c, x[i+ 7], 10,  1126891415);
 538      c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
 539      b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
 540      a = md5_ii(a, b, c, d, x[i+12], 6 ,  1700485571);
 541      d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
 542      c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
 543      b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
 544      a = md5_ii(a, b, c, d, x[i+ 8], 6 ,  1873313359);
 545      d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
 546      c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
 547      b = md5_ii(b, c, d, a, x[i+13], 21,  1309151649);
 548      a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
 549      d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
 550      c = md5_ii(c, d, a, b, x[i+ 2], 15,  718787259);
 551      b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
 552  
 553      a = safe_add(a, olda);
 554      b = safe_add(b, oldb);
 555      c = safe_add(c, oldc);
 556      d = safe_add(d, oldd);
 557    }
 558    return Array(a, b, c, d);
 559  }
 560  
 561  /*

 562   * These functions implement the four basic operations the algorithm uses.

 563   */
 564  function md5_cmn(q, a, b, x, s, t)
 565  {
 566    return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
 567  }
 568  function md5_ff(a, b, c, d, x, s, t)
 569  {
 570    return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
 571  }
 572  function md5_gg(a, b, c, d, x, s, t)
 573  {
 574    return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
 575  }
 576  function md5_hh(a, b, c, d, x, s, t)
 577  {
 578    return md5_cmn(b ^ c ^ d, a, b, x, s, t);
 579  }
 580  function md5_ii(a, b, c, d, x, s, t)
 581  {
 582    return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
 583  }

title

Description

title

Description

title

Description

title

title

Body