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

Method fromOctetString

modules/crypt/arith/ecp.js:77–84  ·  view source on GitHub ↗
(os)

Source from the content-addressed store, hash-verified

75 }
76 };
77 static fromOctetString(os) {
78 if (os[0] != 0x04)
79 throw new Error("unsupported format");
80 let flen = (os.length - 1) >> 1;
81 let x = BigInt.fromArrayBuffer(os.slice(1, 1 + flen).buffer);
82 let y = BigInt.fromArrayBuffer(os.slice(1 + flen, os.length).buffer);
83 return new ECPoint(x, y);
84 }
85};
86
87Object.freeze(ECPoint.prototype);

Callers 1

decodeSPKIFunction · 0.80

Calls 2

fromArrayBufferMethod · 0.65
sliceMethod · 0.65

Tested by

no test coverage detected