Code Duplication    Length = 8-10 lines in 2 locations

build/asmcrypto.js 1 location

@@ 3751-3760 (lines=10) @@
3748
3749
    var blocks = Math.ceil( length / this.hmac.HMAC_SIZE );
3750
3751
    for ( var i = 1; i <= blocks; ++i ) {
3752
        var j = ( i - 1 ) * this.hmac.HMAC_SIZE;
3753
        var l = ( i < blocks ? 0 : length % this.hmac.HMAC_SIZE ) || this.hmac.HMAC_SIZE;
3754
        var tmp = new Uint8Array( this.hmac.reset().process(salt).process( new Uint8Array([ i>>>24&0xff, i>>>16&0xff, i>>>8&0xff, i&0xff ]) ).finish().result );
3755
        this.result.set( tmp.subarray( 0, l ), j );
3756
        for ( var k = 1; k < count; ++k ) {
3757
            tmp = new Uint8Array( this.hmac.reset().process(tmp).finish().result );
3758
            for ( var r = 0; r < l; ++r ) this.result[j+r] ^= tmp[r];
3759
        }
3760
    }
3761
3762
    return this;
3763
}

build/asmcrypto.min.js 1 location

@@ 3533-3540 (lines=8) @@
3530
        if (null !== this.result) throw new r("state must be reset before processing new data");
3531
        if (!e && !a(e)) throw new s("bad 'salt' value");
3532
        t = t || this.count, c = c || this.length, this.result = new Uint8Array(c);
3533
        for (var i = Math.ceil(c / this.hmac.HMAC_SIZE), n = 1; n <= i; ++n) {
3534
            var h = (n - 1) * this.hmac.HMAC_SIZE, f = (n < i ? 0 : c % this.hmac.HMAC_SIZE) || this.hmac.HMAC_SIZE, x = new Uint8Array(this.hmac.reset().process(e).process(new Uint8Array([ n >>> 24 & 255, n >>> 16 & 255, n >>> 8 & 255, 255 & n ])).finish().result);
3535
            this.result.set(x.subarray(0, f), h);
3536
            for (var o = 1; o < t; ++o) {
3537
                x = new Uint8Array(this.hmac.reset().process(x).finish().result);
3538
                for (var u = 0; u < f; ++u) this.result[h + u] ^= x[u];
3539
            }
3540
        }
3541
        return this;
3542
    };
3543
    var C = y.prototype;