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

Function modPow

systemvm/agent/noVNC/core/crypto/bigint.js:1–12  ·  view source on GitHub ↗
(b, e, m)

Source from the content-addressed store, hash-verified

1export function modPow(b, e, m) {
2 let r = 1n;
3 b = b % m;
4 while (e > 0n) {
5 if ((e & 1n) === 1n) {
6 r = (r * b) % m;
7 }
8 e = e >> 1n;
9 b = (b * b) % m;
10 }
11 return r;
12}
13
14export function bigIntToU8Array(bigint, padLength=0) {
15 let hex = bigint.toString(16);

Callers 4

_generateKeyMethod · 0.90
deriveBitsMethod · 0.90
encryptMethod · 0.90
decryptMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected