function binb_sha1 (x, len) {
  // append padding
  x[len >> 5] |= 0x80 << (24 - len % 32);
  x[((len + 64 >> 9) << 4) + 15] = len;

  var w = Array(80);
  var a =  1732584193;
  var b = -271733879;
  var c = -1732584194;
  var d =  271733878;
  var e = -1009589776;
  var t, oa, ob, oc, od, oe, i = 0, j = 0;

  for (i; i < x.length; i += 16) {
    oa = a;
    ob = b;
    oc = c;
    od = d;
    oe = e;

    for (j; j < 80; j++) {
      if (j < 16) w[j] = x[i + j];
      else w[j] = bit_rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1);
      t = safe_add(safe_add(bit_rol(a, 5), sha1_ft(j, b, c, d)), safe_add(safe_add(e, w[j]), sha1_kt(j)));
      e = d;
      d = c;
      c = bit_rol(b, 30);
      b = a;
      a = t;
    }

    a = safe_add(a, oa);
    b = safe_add(b, ob);
    c = safe_add(c, oc);
    d = safe_add(d, od);
    e = safe_add(e, oe);
  }

  return Array(a, b, c, d, e);
}
function binb_sha1 (x, len) {
  
  x[len >> 5] |= 0x80 << (24 - len % 32);
  x[((len + 64 >> 9) << 4) + 15] = len;

  var w = Array(80);
  var a =  1732584193;
  var b = -271733879;
  var c = -1732584194;
  var d =  271733878;
  var e = -1009589776;
  var t, oa, ob, oc, od, oe, i = 0, j = 0;

  for (i; i < x.length; i += 16) {
    oa = a;
    ob = b;
    oc = c;
    od = d;
    oe = e;

    for (j; j < 80; j++) {
      if (j < 16) w[j] = x[i + j];
      else w[j] = bit_rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1);
      t = safe_add(safe_add(bit_rol(a, 5), sha1_ft(j, b, c, d)), safe_add(safe_add(e, w[j]), sha1_kt(j)));
      e = d;
      d = c;
      c = bit_rol(b, 30);
      b = a;
      a = t;
    }

    a = safe_add(a, oa);
    b = safe_add(b, ob);
    c = safe_add(c, oc);
    d = safe_add(d, od);
    e = safe_add(e, oe);
  }

  return Array(a, b, c, d, e);
}
function binb_sha1 ( x , len ) { // append padding x [ len >> 5 ] |= 0x80 << ( 24 - len % 32 ) ; x [ ( ( len + 64 >> 9 ) << 4 ) + 15 ] = len ; var w = Array ( 80 ) ; var a = 1732584193 ; var b = - 271733879 ; var c = - 1732584194 ; var d = 271733878 ; var e = - 1009589776 ; var t , oa , ob , oc , od , oe , i = 0 , j = 0 ; for ( i ; i < x . length ; i += 16 ) { oa = a ; ob = b ; oc = c ; od = d ; oe = e ; for ( j ; j < 80 ; j ++ ) { if ( j < 16 ) w [ j ] = x [ i + j ] ; else w [ j ] = bit_rol ( w [ j - 3 ] ^ w [ j - 8 ] ^ w [ j - 14 ] ^ w [ j - 16 ] , 1 ) ; t = safe_add ( safe_add ( bit_rol ( a , 5 ) , sha1_ft ( j , b , c , d ) ) , safe_add ( safe_add ( e , w [ j ] ) , sha1_kt ( j ) ) ) ; e = d ; d = c ; c = bit_rol ( b , 30 ) ; b = a ; a = t ; } a = safe_add ( a , oa ) ; b = safe_add ( b , ob ) ; c = safe_add ( c , oc ) ; d = safe_add ( d , od ) ; e = safe_add ( e , oe ) ; } return Array ( a , b , c , d , e ) ; }
Calculate the SHA-1 of an array of big-endian words, and a bit length
Calculate the SHA - 1 of an array of big - endian words and a bit length