(iv, aad)
| 49 | this.zero = new ArrayBuffer(this.block.blockSize); |
| 50 | }; |
| 51 | init(iv, aad) { |
| 52 | let h = this.block.encrypt(this.zero); |
| 53 | this.ghash = new GHASH(h, aad); |
| 54 | if (iv.byteLength == 12) { |
| 55 | iv = iv.concat(one); |
| 56 | } |
| 57 | else { |
| 58 | let ghash = new GHASH(h); |
| 59 | iv = ghash.process(iv); |
| 60 | } |
| 61 | this.y0 = iv; |
| 62 | // start with y1 |
| 63 | let y1 = BigInt.fromArrayBuffer(iv); |
| 64 | y1++; |
| 65 | this.ctr.setIV(ArrayBuffer.fromBigInt(y1)); |
| 66 | } |
| 67 | encrypt(data, buf) { |
| 68 | buf = this.ctr.encrypt(data, buf); |
| 69 | this.ghash.update(buf); |
no test coverage detected