MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / process

Method process

modules/crypt/etc/gcm.js:80–98  ·  view source on GitHub ↗
(data, buf, iv, aad, encFlag)

Source from the content-addressed store, hash-verified

78 return Bin.xor(t, this.block.encrypt(this.y0));
79 };
80 process(data, buf, iv, aad, encFlag) {
81 if (encFlag) {
82 this.init(iv, aad);
83 buf = this.encrypt(data, buf);
84 let tag = this.close();
85 if (tag.byteLength > this.tagLength)
86 tag = tag.slice(0, this.tagLength);
87 return buf.concat(tag);
88 }
89 else {
90 this.init(iv, aad);
91
92 const subarray = data.subarray(0, data.byteLength - this.tagLength);
93 buf = this.decrypt(subarray, (buf === data) ? subarray : buf);
94 const tag = this.close();
95 if (Bin.comp(tag, data.subarray(data.byteLength - this.tagLength), this.tagLength) === 0)
96 return buf;
97 }
98 };
99};

Callers 11

signMethod · 0.45
verifyMethod · 0.45
encryptMethod · 0.45
decryptMethod · 0.45
initMethod · 0.45
pkcs12genFunction · 0.45
unpacketizeFunction · 0.45
packetizeFunction · 0.45
unpacketizeFunction · 0.45
packetizeFunction · 0.45
_verifyMethod · 0.45

Calls 6

initMethod · 0.95
encryptMethod · 0.95
closeMethod · 0.95
decryptMethod · 0.95
sliceMethod · 0.65
concatMethod · 0.65

Tested by

no test coverage detected