MCPcopy Create free account
hub / github.com/apache/cloudstack / deriveBits

Method deriveBits

systemvm/agent/noVNC/core/crypto/dh.js:48–54  ·  view source on GitHub ↗
(algorithm, length)

Source from the content-addressed store, hash-verified

46 }
47
48 deriveBits(algorithm, length) {
49 const bytes = Math.ceil(length / 8);
50 const pkey = new Uint8Array(algorithm.public);
51 const len = bytes > this._keyBytes ? bytes : this._keyBytes;
52 const secret = modPow(u8ArrayToBigInt(pkey), this._privateKeyBigInt, this._pBigInt);
53 return bigIntToU8Array(secret, len).slice(0, len);
54 }
55}

Callers 2

Calls 4

modPowFunction · 0.90
u8ArrayToBigIntFunction · 0.90
bigIntToU8ArrayFunction · 0.90
sliceMethod · 0.80

Tested by

no test coverage detected