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

Method _getObjectIdentifier

modules/crypt/etc/ber.js:126–141  ·  view source on GitHub ↗
(len)

Source from the content-addressed store, hash-verified

124 return this._getObjectIdentifier(this.getLength())
125 }
126 _getObjectIdentifier(len) {
127 let i = this.#a[this.#i++];
128 const oid = new Uint32Array(new ArrayBuffer((2 + len) << 2, {maxByteLength: (2 + len) << 2}));
129 oid[0] = Math.idiv(i, 40);
130 oid[1] = Math.irem(i, 40);
131 let index = 2;
132 --len;
133 while (len > 0) {
134 let v = 0;
135 while (--len >= 0 && (i = this.#a[this.#i++]) >= 0x80)
136 v = (v << 7) | (i & 0x7f);
137 oid[index++] = (v << 7) | i;
138 }
139 oid.buffer.resize(index << 2);
140 return oid;
141 }
142 getSequence() {
143 if (this.getTag() != 0x30)
144 throw new Error("BER: not a sequence");

Callers 2

getObjectIdentifierMethod · 0.95
decodeTagMethod · 0.80

Calls 2

idivMethod · 0.80
iremMethod · 0.80

Tested by

no test coverage detected