Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@eyhn/crypto

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eyhn/crypto - npm Package Compare versions

Comparing version 1.0.8 to 1.0.9

26

lib/bigint/index.js

@@ -1,19 +0,9 @@

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports", "big-integer"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const BigInt = require("big-integer");
function arrayBufferToBigInt(ba) {
let array = new Uint8Array(ba);
return BigInt.fromArray(Array.from(array), 256);
}
exports.arrayBufferToBigInt = arrayBufferToBigInt;
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const BigInt = require("big-integer");
function arrayBufferToBigInt(ba) {
let array = new Uint8Array(ba);
return BigInt.fromArray(Array.from(array), 256);
}
exports.arrayBufferToBigInt = arrayBufferToBigInt;
//# sourceMappingURL=index.js.map

@@ -1,46 +0,36 @@

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
"use strict";
const encrypt_1 = require("./pkcs1/encrypt");
const hex_1 = require("./utils/hex");
const text_1 = require("./utils/text");
const padding_1 = require("./pkcs1/padding");
const unpadding_1 = require("./pkcs1/unpadding");
const dopublic_1 = require("./pkcs1/dopublic");
const doprivate_1 = require("./pkcs1/doprivate");
const generate_1 = require("./pkcs1/generate");
const decrypt_1 = require("./pkcs1/decrypt");
const sign_1 = require("./pkcs1/sign");
const bigint_1 = require("./bigint");
const sha256_1 = require("./sha256");
const verify_1 = require("./pkcs1/verify");
module.exports = {
rsa: {
decrypt: decrypt_1.default,
encrypt: encrypt_1.default,
padding: padding_1.default,
unpadding: unpadding_1.default,
dopublic: dopublic_1.default,
doprivate: doprivate_1.default,
generate: generate_1.default,
sign: sign_1.default,
verify: verify_1.default
},
sha256: sha256_1.default,
tools: {
hexToArrayBuffer: hex_1.hexToArrayBuffer,
arrayBufferToHex: hex_1.arrayBufferToHex,
textToArrayBuffer: text_1.textToArrayBuffer,
arrayBufferToText: text_1.arrayBufferToText,
arrayBufferToBigInt: bigint_1.arrayBufferToBigInt
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports", "./pkcs1/encrypt", "./utils/hex", "./utils/text", "./pkcs1/padding", "./pkcs1/unpadding", "./pkcs1/dopublic", "./pkcs1/doprivate", "./pkcs1/generate", "./pkcs1/decrypt", "./pkcs1/sign", "./bigint", "./sha256", "./pkcs1/verify"], factory);
}
})(function (require, exports) {
"use strict";
const encrypt_1 = require("./pkcs1/encrypt");
const hex_1 = require("./utils/hex");
const text_1 = require("./utils/text");
const padding_1 = require("./pkcs1/padding");
const unpadding_1 = require("./pkcs1/unpadding");
const dopublic_1 = require("./pkcs1/dopublic");
const doprivate_1 = require("./pkcs1/doprivate");
const generate_1 = require("./pkcs1/generate");
const decrypt_1 = require("./pkcs1/decrypt");
const sign_1 = require("./pkcs1/sign");
const bigint_1 = require("./bigint");
const sha256_1 = require("./sha256");
const verify_1 = require("./pkcs1/verify");
return {
rsa: {
decrypt: decrypt_1.default,
encrypt: encrypt_1.default,
padding: padding_1.default,
unpadding: unpadding_1.default,
dopublic: dopublic_1.default,
doprivate: doprivate_1.default,
generate: generate_1.default,
sign: sign_1.default,
verify: verify_1.default
},
sha256: sha256_1.default,
tools: {
hexToArrayBuffer: hex_1.hexToArrayBuffer,
arrayBufferToHex: hex_1.arrayBufferToHex,
textToArrayBuffer: text_1.textToArrayBuffer,
arrayBufferToText: text_1.arrayBufferToText,
arrayBufferToBigInt: bigint_1.arrayBufferToBigInt
}
};
});
};
//# sourceMappingURL=index.js.map

@@ -1,13 +0,3 @@

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=TypedArray.js.map

@@ -1,21 +0,11 @@

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports", "./doprivate", "./unpadding"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const doprivate_1 = require("./doprivate");
const unpadding_1 = require("./unpadding");
function pkcs1decrypt(d, n, buffer) {
const m = doprivate_1.default(d, n, buffer);
return unpadding_1.default(m, n.byteLength);
;
}
exports.default = pkcs1decrypt;
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const doprivate_1 = require("./doprivate");
const unpadding_1 = require("./unpadding");
function pkcs1decrypt(d, n, buffer) {
const m = doprivate_1.default(d, n, buffer);
return unpadding_1.default(m, n.byteLength);
;
}
exports.default = pkcs1decrypt;
//# sourceMappingURL=decrypt.js.map

@@ -1,21 +0,11 @@

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports", "../bigint"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const bigint_1 = require("../bigint");
function pkcs1doprivate(d, n, data) {
const datai = bigint_1.arrayBufferToBigInt(data);
const di = bigint_1.arrayBufferToBigInt(d);
const ni = bigint_1.arrayBufferToBigInt(n);
return new Uint8Array(datai.modPow(di, ni).toArray(256).value).buffer;
}
exports.default = pkcs1doprivate;
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const bigint_1 = require("../bigint");
function pkcs1doprivate(d, n, data) {
const datai = bigint_1.arrayBufferToBigInt(data);
const di = bigint_1.arrayBufferToBigInt(d);
const ni = bigint_1.arrayBufferToBigInt(n);
return new Uint8Array(datai.modPow(di, ni).toArray(256).value).buffer;
}
exports.default = pkcs1doprivate;
//# sourceMappingURL=doprivate.js.map

@@ -1,20 +0,10 @@

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports", "../bigint"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const bigint_1 = require("../bigint");
function pkcs1dopublic(x, n, e) {
const xi = bigint_1.arrayBufferToBigInt(x);
const ni = bigint_1.arrayBufferToBigInt(n);
return new Uint8Array(xi.modPow(e, ni).toArray(256).value).buffer;
}
exports.default = pkcs1dopublic;
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const bigint_1 = require("../bigint");
function pkcs1dopublic(x, n, e) {
const xi = bigint_1.arrayBufferToBigInt(x);
const ni = bigint_1.arrayBufferToBigInt(n);
return new Uint8Array(xi.modPow(e, ni).toArray(256).value).buffer;
}
exports.default = pkcs1dopublic;
//# sourceMappingURL=dopublic.js.map

@@ -1,21 +0,11 @@

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports", "./padding", "./dopublic"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const padding_1 = require("./padding");
const dopublic_1 = require("./dopublic");
function pkcs1encrypt(buffer, n, e) {
let m = padding_1.default(buffer, n.byteLength);
let c = dopublic_1.default(m, n, e);
return c;
}
exports.default = pkcs1encrypt;
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const padding_1 = require("./padding");
const dopublic_1 = require("./dopublic");
function pkcs1encrypt(buffer, n, e) {
let m = padding_1.default(buffer, n.byteLength);
let c = dopublic_1.default(m, n, e);
return c;
}
exports.default = pkcs1encrypt;
//# sourceMappingURL=encrypt.js.map

@@ -1,82 +0,72 @@

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const prng_1 = require("../rng/prng");
const BigInt = require("big-integer");
const bigint_1 = require("../bigint");
const alea_1 = require("../rng/alea");
function generateRandomBiting(bitlength, prng) {
const x = new Uint8Array(bitlength >> 3 + 1), t = bitlength & 7;
prng(x);
if (t > 0)
x[0] &= ((1 << t) - 1);
else
x[0] = 0;
return bigint_1.arrayBufferToBigInt(x);
}
exports.generateRandomBiting = generateRandomBiting;
function generatePrime(bitlength, prng) {
let bi = generateRandomBiting(bitlength, prng);
bi = bi.or(BigInt.one.shiftLeft(bitlength - 1)); // force MSB set;
if (bi.isEven())
bi = bi.add(BigInt.one);
while (!bi.isProbablePrime(1)) {
bi = bi.add(2);
if (bi.bitLength().greater(bitlength))
bi = bi.subtract(BigInt.one.shiftLeft(bitlength - 1));
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports", "../rng/prng", "big-integer", "../bigint", "../rng/alea"], factory);
return bi;
}
exports.generatePrime = generatePrime;
function pkcs1generate(bitlength, expt, seed) {
const rng = seed ? alea_1.default(seed) : prng_1.default();
const qs = bitlength >> 1;
const ee = BigInt(expt);
let p, q;
while (true) {
p = generatePrime(bitlength - qs, rng);
if (BigInt.gcd(p.subtract(BigInt.one), ee).equals(BigInt.one) && p.isProbablePrime(10))
break;
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const prng_1 = require("../rng/prng");
const BigInt = require("big-integer");
const bigint_1 = require("../bigint");
const alea_1 = require("../rng/alea");
function generateRandomBiting(bitlength, prng) {
const x = new Uint8Array(bitlength >> 3 + 1), t = bitlength & 7;
prng(x);
if (t > 0)
x[0] &= ((1 << t) - 1);
else
x[0] = 0;
return bigint_1.arrayBufferToBigInt(x);
while (true) {
q = generatePrime(qs, rng);
if (BigInt.gcd(q.subtract(BigInt.one), ee).equals(BigInt.one) && q.isProbablePrime(10))
break;
}
exports.generateRandomBiting = generateRandomBiting;
function generatePrime(bitlength, prng) {
let bi = generateRandomBiting(bitlength, prng);
bi = bi.or(BigInt.one.shiftLeft(bitlength - 1)); // force MSB set;
if (bi.isEven())
bi = bi.add(BigInt.one);
while (!bi.isProbablePrime(1)) {
bi = bi.add(2);
if (bi.bitLength().greater(bitlength))
bi = bi.subtract(BigInt.one.shiftLeft(bitlength - 1));
}
return bi;
if (p.lesserOrEquals(q)) {
const t = p;
p = q;
q = t;
}
exports.generatePrime = generatePrime;
function pkcs1generate(bitlength, expt, seed) {
const rng = seed ? alea_1.default(seed) : prng_1.default();
const qs = bitlength >> 1;
const ee = BigInt(expt);
let p, q;
while (true) {
p = generatePrime(bitlength - qs, rng);
if (BigInt.gcd(p.subtract(BigInt.one), ee).equals(BigInt.one) && p.isProbablePrime(10))
break;
}
while (true) {
q = generatePrime(qs, rng);
if (BigInt.gcd(q.subtract(BigInt.one), ee).equals(BigInt.one) && q.isProbablePrime(10))
break;
}
if (p.lesserOrEquals(q)) {
const t = p;
p = q;
q = t;
}
const p1 = p.subtract(BigInt.one);
const q1 = q.subtract(BigInt.one);
const phi = p1.multiply(q1);
if (BigInt.gcd(phi, ee).equals(BigInt.one)) {
const n = p.multiply(q);
const d = ee.modInv(phi);
const dmp1 = d.mod(p1);
const dmq1 = d.mod(q1);
const coeff = q.modInv(p);
return {
n: new Uint8Array(n.toArray(256).value).buffer,
d: new Uint8Array(d.toArray(256).value).buffer,
p: new Uint8Array(p.toArray(256).value).buffer,
q: new Uint8Array(q.toArray(256).value).buffer,
dmp1: new Uint8Array(dmp1.toArray(256).value).buffer,
dmq1: new Uint8Array(dmq1.toArray(256).value).buffer,
coeff: new Uint8Array(coeff.toArray(256).value).buffer
};
}
throw new Error("pkcs1 generate failure!");
const p1 = p.subtract(BigInt.one);
const q1 = q.subtract(BigInt.one);
const phi = p1.multiply(q1);
if (BigInt.gcd(phi, ee).equals(BigInt.one)) {
const n = p.multiply(q);
const d = ee.modInv(phi);
const dmp1 = d.mod(p1);
const dmq1 = d.mod(q1);
const coeff = q.modInv(p);
return {
n: new Uint8Array(n.toArray(256).value).buffer,
d: new Uint8Array(d.toArray(256).value).buffer,
p: new Uint8Array(p.toArray(256).value).buffer,
q: new Uint8Array(q.toArray(256).value).buffer,
dmp1: new Uint8Array(dmp1.toArray(256).value).buffer,
dmq1: new Uint8Array(dmq1.toArray(256).value).buffer,
coeff: new Uint8Array(coeff.toArray(256).value).buffer
};
}
exports.default = pkcs1generate;
});
throw new Error("pkcs1 generate failure!");
}
exports.default = pkcs1generate;
//# sourceMappingURL=generate.js.map

@@ -1,36 +0,26 @@

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const prng_1 = require("../rng/prng");
function pkcs1padding(s, n) {
if (n < s.byteLength + 11) {
throw new Error("Message too long for RSA");
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports", "../rng/prng"], factory);
const random = new Uint8Array(n - s.byteLength - 3);
const x = new Uint8Array(1);
const rngfn = prng_1.default();
for (let i = 0; i < random.length; i++) {
x[0] = 0;
while (x[0] == 0)
rngfn(x);
random[i] = x[0];
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const prng_1 = require("../rng/prng");
function pkcs1padding(s, n) {
if (n < s.byteLength + 11) {
throw new Error("Message too long for RSA");
}
const random = new Uint8Array(n - s.byteLength - 3);
const x = new Uint8Array(1);
const rngfn = prng_1.default();
for (let i = 0; i < random.length; i++) {
x[0] = 0;
while (x[0] == 0)
rngfn(x);
random[i] = x[0];
}
const ba = new Uint8Array(n);
ba[0] = 0;
ba[1] = 2;
ba.set(random, 2);
ba[random.byteLength + 2] = 0;
ba.set(new Uint8Array(s), random.byteLength + 3);
return ba.buffer;
}
exports.default = pkcs1padding;
});
const ba = new Uint8Array(n);
ba[0] = 0;
ba[1] = 2;
ba.set(random, 2);
ba[random.byteLength + 2] = 0;
ba.set(new Uint8Array(s), random.byteLength + 3);
return ba.buffer;
}
exports.default = pkcs1padding;
//# sourceMappingURL=padding.js.map

@@ -1,35 +0,25 @@

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports", "../utils/hex", "./doprivate", "../sha256", "../utils/arraybuffer"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const hex_1 = require("../utils/hex");
const doprivate_1 = require("./doprivate");
const sha256_1 = require("../sha256");
const arraybuffer_1 = require("../utils/arraybuffer");
const DigestInfo = hex_1.hexToArrayBuffer("3031300d060960864801650304020105000420");
function getPaddedDigestInfoHex(hash, keyByteLength) {
const head = hex_1.hexToArrayBuffer("0001");
const fLen = keyByteLength - head.byteLength - 1 - DigestInfo.byteLength - hash.byteLength;
const mid = new Uint8Array(fLen);
mid.fill(255);
const padded = arraybuffer_1.mergeArrayBuffer(head, mid, new Uint8Array([0]), DigestInfo, hash);
return padded;
}
function signWithMessageHash(hash, d, n) {
const pm = getPaddedDigestInfoHex(hash, n.byteLength);
const sign = doprivate_1.default(d, n, pm);
return sign;
}
function pkcs1sign(data, d, n) {
return signWithMessageHash(sha256_1.default(data), d, n);
}
exports.default = pkcs1sign;
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const hex_1 = require("../utils/hex");
const doprivate_1 = require("./doprivate");
const sha256_1 = require("../sha256");
const arraybuffer_1 = require("../utils/arraybuffer");
const DigestInfo = hex_1.hexToArrayBuffer("3031300d060960864801650304020105000420");
function getPaddedDigestInfoHex(hash, keyByteLength) {
const head = hex_1.hexToArrayBuffer("0001");
const fLen = keyByteLength - head.byteLength - 1 - DigestInfo.byteLength - hash.byteLength;
const mid = new Uint8Array(fLen);
mid.fill(255);
const padded = arraybuffer_1.mergeArrayBuffer(head, mid, new Uint8Array([0]), DigestInfo, hash);
return padded;
}
function signWithMessageHash(hash, d, n) {
const pm = getPaddedDigestInfoHex(hash, n.byteLength);
const sign = doprivate_1.default(d, n, pm);
return sign;
}
function pkcs1sign(data, d, n) {
return signWithMessageHash(sha256_1.default(data), d, n);
}
exports.default = pkcs1sign;
//# sourceMappingURL=sign.js.map

@@ -1,28 +0,18 @@

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function pkcs1unpadding(b, n) {
const view = new Uint8Array(b);
let point = 0;
while (point < view.byteLength && view[point] == 0)
++point;
if (view.byteLength - point != n - 1 || view[point] != 2)
throw new Error('PKCS1 unpadding error.');
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function pkcs1unpadding(b, n) {
const view = new Uint8Array(b);
let point = 0;
while (point < view.byteLength && view[point] == 0)
++point;
while (view[point] != 0)
if (++point >= view.length)
return null;
++point;
return view.slice(point);
}
exports.default = pkcs1unpadding;
});
if (view.byteLength - point != n - 1 || view[point] != 2)
throw new Error('PKCS1 unpadding error.');
++point;
while (view[point] != 0)
if (++point >= view.length)
return null;
++point;
return view.slice(point);
}
exports.default = pkcs1unpadding;
//# sourceMappingURL=unpadding.js.map

@@ -1,29 +0,19 @@

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const dopublic_1 = require("./dopublic");
const hex_1 = require("../utils/hex");
const sha256_1 = require("../sha256");
const arraybuffer_1 = require("../utils/arraybuffer");
const DigestInfo = hex_1.hexToArrayBuffer("3031300d060960864801650304020105000420");
function pkcs1verify(date, sign, n, e) {
const decryptedSign = new Uint8Array(dopublic_1.default(sign, n, e));
if (arraybuffer_1.compareArrayBuffer(decryptedSign.slice(0, DigestInfo.byteLength), DigestInfo)) {
const hash = decryptedSign.slice(DigestInfo.byteLength);
return arraybuffer_1.compareArrayBuffer(sha256_1.default(date), hash);
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports", "./dopublic", "../utils/hex", "../sha256", "../utils/arraybuffer"], factory);
else {
return false;
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const dopublic_1 = require("./dopublic");
const hex_1 = require("../utils/hex");
const sha256_1 = require("../sha256");
const arraybuffer_1 = require("../utils/arraybuffer");
const DigestInfo = hex_1.hexToArrayBuffer("3031300d060960864801650304020105000420");
function pkcs1verify(date, sign, n, e) {
const decryptedSign = new Uint8Array(dopublic_1.default(sign, n, e));
if (arraybuffer_1.compareArrayBuffer(decryptedSign.slice(0, DigestInfo.byteLength), DigestInfo)) {
const hash = decryptedSign.slice(DigestInfo.byteLength);
return arraybuffer_1.compareArrayBuffer(sha256_1.default(date), hash);
}
else {
return false;
}
}
exports.default = pkcs1verify;
});
}
exports.default = pkcs1verify;
//# sourceMappingURL=verify.js.map

@@ -1,51 +0,41 @@

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports", "./prng"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const prng_1 = require("./prng");
function Alea(seed) {
if (seed === undefined) {
try {
const seedba = new Uint8Array(256);
prng_1.default()(seedba);
seed = String.fromCharCode.apply(0, seedba);
}
catch (e) {
seed = +new Date + Math.random();
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const prng_1 = require("./prng");
function Alea(seed) {
if (seed === undefined) {
try {
const seedba = new Uint8Array(256);
prng_1.default()(seedba);
seed = String.fromCharCode.apply(0, seedba);
}
function Mash() {
var n = 4022871197;
return function (r) {
for (var t, s, f, u = 0, e = 0.02519603282416938; u < r.length; u++)
s = r.charCodeAt(u), f = (e * (n += s) - (n * e | 0)),
n = 4294967296 * ((t = f * (e * n | 0)) - (t | 0)) + (t | 0);
return (n | 0) * 2.3283064365386963e-10;
};
catch (e) {
seed = +new Date + Math.random();
}
return function () {
var m = Mash(), a = m(" "), b = m(" "), c = m(" "), x = 1;
seed = seed.toString(), a -= m(seed), b -= m(seed), c -= m(seed);
a < 0 && a++, b < 0 && b++, c < 0 && c++;
const fn = function () {
var y = x * 2.3283064365386963e-10 + a * 2091639;
a = b, b = c;
return c = y - (x = y | 0);
};
return function (ba) {
const ta = new Uint8Array(ba.buffer);
for (let i = 0; i < ta.length; ++i)
ta[i] = fn() * 256 & 0xff;
};
}();
}
exports.default = Alea;
});
function Mash() {
var n = 4022871197;
return function (r) {
for (var t, s, f, u = 0, e = 0.02519603282416938; u < r.length; u++)
s = r.charCodeAt(u), f = (e * (n += s) - (n * e | 0)),
n = 4294967296 * ((t = f * (e * n | 0)) - (t | 0)) + (t | 0);
return (n | 0) * 2.3283064365386963e-10;
};
}
return function () {
var m = Mash(), a = m(" "), b = m(" "), c = m(" "), x = 1;
seed = seed.toString(), a -= m(seed), b -= m(seed), c -= m(seed);
a < 0 && a++, b < 0 && b++, c < 0 && c++;
const fn = function () {
var y = x * 2.3283064365386963e-10 + a * 2091639;
a = b, b = c;
return c = y - (x = y | 0);
};
return function (ba) {
const ta = new Uint8Array(ba.buffer);
for (let i = 0; i < ta.length; ++i)
ta[i] = fn() * 256 & 0xff;
};
}();
}
exports.default = Alea;
//# sourceMappingURL=alea.js.map

@@ -1,35 +0,25 @@

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function prng() {
if (typeof window !== "undefined") {
// Browser
if (typeof window.crypto !== "undefined") {
return (ba) => window.crypto.getRandomValues(ba);
}
else {
return (ba) => {
var l = ba.length;
while (l--) {
ba[l] = Math.floor(Math.random() * 256);
}
};
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function prng() {
if (typeof window !== "undefined") {
// Browser
if (typeof window.crypto !== "undefined") {
return (ba) => window.crypto.getRandomValues(ba);
}
else {
// Node.JS
const crypto = require('crypto');
return (ba) => crypto.randomFillSync(ba);
return (ba) => {
var l = ba.length;
while (l--) {
ba[l] = Math.floor(Math.random() * 256);
}
};
}
}
exports.default = prng;
});
else {
// Node.JS
const crypto = require('crypto');
return (ba) => crypto.randomFillSync(ba);
}
}
exports.default = prng;
//# sourceMappingURL=prng.js.map

@@ -1,134 +0,124 @@

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const K = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2];
const INIT = new Uint32Array([0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19]);
const EXTRA = [-2147483648, 8388608, 32768, 128];
const SHIFT = [24, 16, 8, 0];
function block(blocks, hash, frist) {
let h0 = hash[0], h1 = hash[1], h2 = hash[2], h3 = hash[3], h4 = hash[4], h5 = hash[5], h6 = hash[6], h7 = hash[7], j, s0, s1, maj, t1, t2, ch, ab, da, cd, bc;
for (j = 16; j < 64; ++j) {
// rightrotate
t1 = blocks[j - 15];
s0 = ((t1 >>> 7) | (t1 << 25)) ^ ((t1 >>> 18) | (t1 << 14)) ^ (t1 >>> 3);
t1 = blocks[j - 2];
s1 = ((t1 >>> 17) | (t1 << 15)) ^ ((t1 >>> 19) | (t1 << 13)) ^ (t1 >>> 10);
blocks[j] = blocks[j - 16] + s0 + blocks[j - 7] + s1 << 0;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const K = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2];
const INIT = new Uint32Array([0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19]);
const EXTRA = [-2147483648, 8388608, 32768, 128];
const SHIFT = [24, 16, 8, 0];
function block(blocks, hash, frist) {
let h0 = hash[0], h1 = hash[1], h2 = hash[2], h3 = hash[3], h4 = hash[4], h5 = hash[5], h6 = hash[6], h7 = hash[7], j, s0, s1, maj, t1, t2, ch, ab, da, cd, bc;
for (j = 16; j < 64; ++j) {
// rightrotate
t1 = blocks[j - 15];
s0 = ((t1 >>> 7) | (t1 << 25)) ^ ((t1 >>> 18) | (t1 << 14)) ^ (t1 >>> 3);
t1 = blocks[j - 2];
s1 = ((t1 >>> 17) | (t1 << 15)) ^ ((t1 >>> 19) | (t1 << 13)) ^ (t1 >>> 10);
blocks[j] = blocks[j - 16] + s0 + blocks[j - 7] + s1 << 0;
bc = h1 & h2;
for (j = 0; j < 64; j += 4) {
if (frist) {
ab = 704751109;
t1 = blocks[0] - 210244248;
h7 = t1 - 1521486534 << 0;
h3 = t1 + 143694565 << 0;
frist = false;
}
bc = h1 & h2;
for (j = 0; j < 64; j += 4) {
if (frist) {
ab = 704751109;
t1 = blocks[0] - 210244248;
h7 = t1 - 1521486534 << 0;
h3 = t1 + 143694565 << 0;
frist = false;
}
else {
s0 = ((h0 >>> 2) | (h0 << 30)) ^ ((h0 >>> 13) | (h0 << 19)) ^ ((h0 >>> 22) | (h0 << 10));
s1 = ((h4 >>> 6) | (h4 << 26)) ^ ((h4 >>> 11) | (h4 << 21)) ^ ((h4 >>> 25) | (h4 << 7));
ab = h0 & h1;
maj = ab ^ (h0 & h2) ^ bc;
ch = (h4 & h5) ^ (~h4 & h6);
t1 = h7 + s1 + ch + K[j] + blocks[j];
t2 = s0 + maj;
h7 = h3 + t1 << 0;
h3 = t1 + t2 << 0;
}
s0 = ((h3 >>> 2) | (h3 << 30)) ^ ((h3 >>> 13) | (h3 << 19)) ^ ((h3 >>> 22) | (h3 << 10));
s1 = ((h7 >>> 6) | (h7 << 26)) ^ ((h7 >>> 11) | (h7 << 21)) ^ ((h7 >>> 25) | (h7 << 7));
da = h3 & h0;
maj = da ^ (h3 & h1) ^ ab;
ch = (h7 & h4) ^ (~h7 & h5);
t1 = h6 + s1 + ch + K[j + 1] + blocks[j + 1];
else {
s0 = ((h0 >>> 2) | (h0 << 30)) ^ ((h0 >>> 13) | (h0 << 19)) ^ ((h0 >>> 22) | (h0 << 10));
s1 = ((h4 >>> 6) | (h4 << 26)) ^ ((h4 >>> 11) | (h4 << 21)) ^ ((h4 >>> 25) | (h4 << 7));
ab = h0 & h1;
maj = ab ^ (h0 & h2) ^ bc;
ch = (h4 & h5) ^ (~h4 & h6);
t1 = h7 + s1 + ch + K[j] + blocks[j];
t2 = s0 + maj;
h6 = h2 + t1 << 0;
h2 = t1 + t2 << 0;
s0 = ((h2 >>> 2) | (h2 << 30)) ^ ((h2 >>> 13) | (h2 << 19)) ^ ((h2 >>> 22) | (h2 << 10));
s1 = ((h6 >>> 6) | (h6 << 26)) ^ ((h6 >>> 11) | (h6 << 21)) ^ ((h6 >>> 25) | (h6 << 7));
cd = h2 & h3;
maj = cd ^ (h2 & h0) ^ da;
ch = (h6 & h7) ^ (~h6 & h4);
t1 = h5 + s1 + ch + K[j + 2] + blocks[j + 2];
t2 = s0 + maj;
h5 = h1 + t1 << 0;
h1 = t1 + t2 << 0;
s0 = ((h1 >>> 2) | (h1 << 30)) ^ ((h1 >>> 13) | (h1 << 19)) ^ ((h1 >>> 22) | (h1 << 10));
s1 = ((h5 >>> 6) | (h5 << 26)) ^ ((h5 >>> 11) | (h5 << 21)) ^ ((h5 >>> 25) | (h5 << 7));
bc = h1 & h2;
maj = bc ^ (h1 & h3) ^ cd;
ch = (h5 & h6) ^ (~h5 & h7);
t1 = h4 + s1 + ch + K[j + 3] + blocks[j + 3];
t2 = s0 + maj;
h4 = h0 + t1 << 0;
h0 = t1 + t2 << 0;
h7 = h3 + t1 << 0;
h3 = t1 + t2 << 0;
}
hash[0] = hash[0] + h0 << 0;
hash[1] = hash[1] + h1 << 0;
hash[2] = hash[2] + h2 << 0;
hash[3] = hash[3] + h3 << 0;
hash[4] = hash[4] + h4 << 0;
hash[5] = hash[5] + h5 << 0;
hash[6] = hash[6] + h6 << 0;
hash[7] = hash[7] + h7 << 0;
s0 = ((h3 >>> 2) | (h3 << 30)) ^ ((h3 >>> 13) | (h3 << 19)) ^ ((h3 >>> 22) | (h3 << 10));
s1 = ((h7 >>> 6) | (h7 << 26)) ^ ((h7 >>> 11) | (h7 << 21)) ^ ((h7 >>> 25) | (h7 << 7));
da = h3 & h0;
maj = da ^ (h3 & h1) ^ ab;
ch = (h7 & h4) ^ (~h7 & h5);
t1 = h6 + s1 + ch + K[j + 1] + blocks[j + 1];
t2 = s0 + maj;
h6 = h2 + t1 << 0;
h2 = t1 + t2 << 0;
s0 = ((h2 >>> 2) | (h2 << 30)) ^ ((h2 >>> 13) | (h2 << 19)) ^ ((h2 >>> 22) | (h2 << 10));
s1 = ((h6 >>> 6) | (h6 << 26)) ^ ((h6 >>> 11) | (h6 << 21)) ^ ((h6 >>> 25) | (h6 << 7));
cd = h2 & h3;
maj = cd ^ (h2 & h0) ^ da;
ch = (h6 & h7) ^ (~h6 & h4);
t1 = h5 + s1 + ch + K[j + 2] + blocks[j + 2];
t2 = s0 + maj;
h5 = h1 + t1 << 0;
h1 = t1 + t2 << 0;
s0 = ((h1 >>> 2) | (h1 << 30)) ^ ((h1 >>> 13) | (h1 << 19)) ^ ((h1 >>> 22) | (h1 << 10));
s1 = ((h5 >>> 6) | (h5 << 26)) ^ ((h5 >>> 11) | (h5 << 21)) ^ ((h5 >>> 25) | (h5 << 7));
bc = h1 & h2;
maj = bc ^ (h1 & h3) ^ cd;
ch = (h5 & h6) ^ (~h5 & h7);
t1 = h4 + s1 + ch + K[j + 3] + blocks[j + 3];
t2 = s0 + maj;
h4 = h0 + t1 << 0;
h0 = t1 + t2 << 0;
}
function sha256(buf) {
const h = new Uint32Array(INIT);
const blocks = new Array(17);
hash[0] = hash[0] + h0 << 0;
hash[1] = hash[1] + h1 << 0;
hash[2] = hash[2] + h2 << 0;
hash[3] = hash[3] + h3 << 0;
hash[4] = hash[4] + h4 << 0;
hash[5] = hash[5] + h5 << 0;
hash[6] = hash[6] + h6 << 0;
hash[7] = hash[7] + h7 << 0;
}
function sha256(buf) {
const h = new Uint32Array(INIT);
const blocks = new Array(17);
blocks.fill(0, 1, 16);
const bufview = new Uint8Array(buf);
let index = 0, i = 0, hashed = false;
while (index < buf.byteLength) {
blocks.fill(0, 1, 16);
const bufview = new Uint8Array(buf);
let index = 0, i = 0, hashed = false;
while (index < buf.byteLength) {
blocks.fill(0, 1, 16);
for (i = 0; index < buf.byteLength && i < 64; index++) {
blocks[i >> 2] |= bufview[index] << SHIFT[i++ & 3];
for (i = 0; index < buf.byteLength && i < 64; index++) {
blocks[i >> 2] |= bufview[index] << SHIFT[i++ & 3];
}
if (i >= 64) {
block(blocks, h, !hashed);
hashed = true;
}
if (index >= buf.byteLength) {
blocks[i >> 2] |= EXTRA[i & 3];
if (i >= 56) {
if (i < 64) {
block(blocks, h, !hashed);
hashed = true;
}
blocks[0] = this.block;
blocks.fill(0, 1, 16);
}
if (i >= 64) {
block(blocks, h, !hashed);
hashed = true;
let bitLength = buf.byteLength * 8, hBitLength = 0;
while (bitLength > 4294967295) {
hBitLength += bitLength / 4294967296 << 0;
bitLength = bitLength % 4294967296;
}
if (index >= buf.byteLength) {
blocks[i >> 2] |= EXTRA[i & 3];
if (i >= 56) {
if (i < 64) {
block(blocks, h, !hashed);
hashed = true;
}
blocks[0] = this.block;
blocks.fill(0, 1, 16);
}
let bitLength = buf.byteLength * 8, hBitLength = 0;
while (bitLength > 4294967295) {
hBitLength += bitLength / 4294967296 << 0;
bitLength = bitLength % 4294967296;
}
blocks[14] = hBitLength;
blocks[15] = bitLength;
block(blocks, h, !hashed);
hashed = true;
}
blocks[14] = hBitLength;
blocks[15] = bitLength;
block(blocks, h, !hashed);
hashed = true;
}
const dataView = new DataView(new ArrayBuffer(32));
for (let i = 0; i < 8; i++) {
dataView.setUint32(i * 4, h[i]);
}
return dataView.buffer;
}
exports.default = sha256;
});
const dataView = new DataView(new ArrayBuffer(32));
for (let i = 0; i < 8; i++) {
dataView.setUint32(i * 4, h[i]);
}
return dataView.buffer;
}
exports.default = sha256;
//# sourceMappingURL=index.js.map

@@ -1,41 +0,31 @@

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function mergeArrayBuffer(...arrayBuffers) {
let totalLength = 0;
arrayBuffers.forEach(item => {
totalLength += item.byteLength;
});
const result = new Uint8Array(totalLength);
let offset = 0;
arrayBuffers.forEach(item => {
result.set(new Uint8Array(item), offset);
offset += item.byteLength;
});
return result.buffer;
}
exports.mergeArrayBuffer = mergeArrayBuffer;
function compareArrayBuffer(a, b) {
if (a.byteLength !== b.byteLength)
return false;
const aView = new Uint8Array(a);
const bview = new Uint8Array(b);
let ok = true;
for (let i = 0; i < aView.byteLength; i++) {
if (aView[i] !== bview[i]) {
ok = false;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function mergeArrayBuffer(...arrayBuffers) {
let totalLength = 0;
arrayBuffers.forEach(item => {
totalLength += item.byteLength;
});
const result = new Uint8Array(totalLength);
let offset = 0;
arrayBuffers.forEach(item => {
result.set(new Uint8Array(item), offset);
offset += item.byteLength;
});
return result.buffer;
}
exports.mergeArrayBuffer = mergeArrayBuffer;
function compareArrayBuffer(a, b) {
if (a.byteLength !== b.byteLength)
return false;
const aView = new Uint8Array(a);
const bview = new Uint8Array(b);
let ok = true;
for (let i = 0; i < aView.byteLength; i++) {
if (aView[i] !== bview[i]) {
ok = false;
}
return ok;
}
exports.compareArrayBuffer = compareArrayBuffer;
});
return ok;
}
exports.compareArrayBuffer = compareArrayBuffer;
//# sourceMappingURL=arraybuffer.js.map

@@ -1,41 +0,31 @@

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function hexToArrayBuffer(hex) {
if (typeof hex !== 'string') {
throw new TypeError('Expected input to be a string');
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
if ((hex.length % 2) !== 0) {
throw new RangeError('Expected string to be an even number of characters');
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function hexToArrayBuffer(hex) {
if (typeof hex !== 'string') {
throw new TypeError('Expected input to be a string');
}
if ((hex.length % 2) !== 0) {
throw new RangeError('Expected string to be an even number of characters');
}
var view = new Uint8Array(hex.length / 2);
for (var i = 0; i < hex.length; i += 2) {
view[i / 2] = parseInt(hex.substring(i, i + 2), 16);
}
return view.buffer;
var view = new Uint8Array(hex.length / 2);
for (var i = 0; i < hex.length; i += 2) {
view[i / 2] = parseInt(hex.substring(i, i + 2), 16);
}
exports.hexToArrayBuffer = hexToArrayBuffer;
function arrayBufferToHex(arrayBuffer) {
if (typeof arrayBuffer !== 'object' || arrayBuffer === null || typeof arrayBuffer.byteLength !== 'number') {
throw new TypeError('Expected input to be an ArrayBuffer');
}
var view = new Uint8Array(arrayBuffer);
var result = '';
var value;
for (var i = 0; i < view.length; i++) {
value = view[i].toString(16);
result += (value.length === 1 ? '0' + value : value);
}
return result;
return view.buffer;
}
exports.hexToArrayBuffer = hexToArrayBuffer;
function arrayBufferToHex(arrayBuffer) {
if (typeof arrayBuffer !== 'object' || arrayBuffer === null || typeof arrayBuffer.byteLength !== 'number') {
throw new TypeError('Expected input to be an ArrayBuffer');
}
exports.arrayBufferToHex = arrayBufferToHex;
});
var view = new Uint8Array(arrayBuffer);
var result = '';
var value;
for (var i = 0; i < view.length; i++) {
value = view[i].toString(16);
result += (value.length === 1 ? '0' + value : value);
}
return result;
}
exports.arrayBufferToHex = arrayBufferToHex;
//# sourceMappingURL=hex.js.map

@@ -1,49 +0,39 @@

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function textToArrayBuffer(s) {
var i = s.length;
var n = 0;
var ba = new Array();
for (var j = 0; j < i;) {
var c = s.codePointAt(j);
if (c < 128) {
ba[n++] = c;
j++;
}
else if ((c > 127) && (c < 2048)) {
ba[n++] = (c >> 6) | 192;
ba[n++] = (c & 63) | 128;
j++;
}
else if ((c > 2047) && (c < 65536)) {
ba[n++] = (c >> 12) | 224;
ba[n++] = ((c >> 6) & 63) | 128;
ba[n++] = (c & 63) | 128;
j++;
}
else {
ba[n++] = (c >> 18) | 240;
ba[n++] = ((c >> 12) & 63) | 128;
ba[n++] = ((c >> 6) & 63) | 128;
ba[n++] = (c & 63) | 128;
j += 2;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function textToArrayBuffer(s) {
var i = s.length;
var n = 0;
var ba = new Array();
for (var j = 0; j < i;) {
var c = s.codePointAt(j);
if (c < 128) {
ba[n++] = c;
j++;
}
return new Uint8Array(ba).buffer;
else if ((c > 127) && (c < 2048)) {
ba[n++] = (c >> 6) | 192;
ba[n++] = (c & 63) | 128;
j++;
}
else if ((c > 2047) && (c < 65536)) {
ba[n++] = (c >> 12) | 224;
ba[n++] = ((c >> 6) & 63) | 128;
ba[n++] = (c & 63) | 128;
j++;
}
else {
ba[n++] = (c >> 18) | 240;
ba[n++] = ((c >> 12) & 63) | 128;
ba[n++] = ((c >> 6) & 63) | 128;
ba[n++] = (c & 63) | 128;
j += 2;
}
}
exports.textToArrayBuffer = textToArrayBuffer;
function arrayBufferToText(buffer) {
return String.fromCharCode.apply(null, new Uint8Array(buffer));
}
exports.arrayBufferToText = arrayBufferToText;
});
return new Uint8Array(ba).buffer;
}
exports.textToArrayBuffer = textToArrayBuffer;
function arrayBufferToText(buffer) {
return String.fromCharCode.apply(null, new Uint8Array(buffer));
}
exports.arrayBufferToText = arrayBufferToText;
//# sourceMappingURL=text.js.map
{
"name": "@eyhn/crypto",
"version": "1.0.8",
"version": "1.0.9",
"main": "lib/index.js",

@@ -5,0 +5,0 @@ "types": "lib/index.d.ts",

@@ -5,3 +5,3 @@ {

"noImplicitAny": true,
"module": "umd",
"module": "commonjs",
"target": "esnext",

@@ -8,0 +8,0 @@ "jsx": "preserve",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc