ooxml-core 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/digest/algorithm-names.d.ts +20 -0
- package/dist/digest/algorithm-names.d.ts.map +1 -0
- package/dist/digest/base64.d.ts +8 -0
- package/dist/digest/base64.d.ts.map +1 -0
- package/dist/digest/digest.d.ts +13 -0
- package/dist/digest/digest.d.ts.map +1 -0
- package/dist/digest/index.cjs +594 -0
- package/dist/digest/index.d.ts +8 -0
- package/dist/digest/index.d.ts.map +1 -0
- package/dist/digest/index.mjs +581 -0
- package/dist/digest/password-hash.d.ts +30 -0
- package/dist/digest/password-hash.d.ts.map +1 -0
- package/dist/digest/sha1.d.ts +3 -0
- package/dist/digest/sha1.d.ts.map +1 -0
- package/dist/digest/sha256.d.ts +10 -0
- package/dist/digest/sha256.d.ts.map +1 -0
- package/dist/digest/sha512.d.ts +5 -0
- package/dist/digest/sha512.d.ts.map +1 -0
- package/dist/docx/block-parser.d.ts.map +1 -1
- package/dist/docx/embedded.cjs +131 -54
- package/dist/docx/embedded.mjs +131 -54
- package/dist/docx/equation.d.ts +8 -0
- package/dist/docx/equation.d.ts.map +1 -0
- package/dist/docx/index.cjs +131 -54
- package/dist/docx/index.mjs +131 -54
- package/dist/docx/layout/adapter.d.ts.map +1 -1
- package/dist/docx/layout/index.cjs +3 -1
- package/dist/docx/layout/index.mjs +3 -1
- package/dist/docx/load/index.cjs +133 -56
- package/dist/docx/load/index.mjs +133 -56
- package/dist/docx/model-run.d.ts +5 -0
- package/dist/docx/model-run.d.ts.map +1 -1
- package/dist/docx/parse-revisions.d.ts.map +1 -1
- package/dist/docx/parse-table.d.ts.map +1 -1
- package/dist/docx/write-inline.d.ts.map +1 -1
- package/dist/docx/write-table-margins.d.ts +5 -0
- package/dist/docx/write-table-margins.d.ts.map +1 -0
- package/dist/docx/write-table-properties.d.ts +3 -1
- package/dist/docx/write-table-properties.d.ts.map +1 -1
- package/dist/docx/write-table.d.ts.map +1 -1
- package/dist/index.cjs +598 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +598 -1
- package/dist/xlsx/edit/history.d.ts +1 -1
- package/dist/xlsx/edit/history.d.ts.map +1 -1
- package/dist/xlsx/edit/index.d.ts +1 -1
- package/dist/xlsx/edit/index.d.ts.map +1 -1
- package/dist/xlsx/edit/protection.d.ts +18 -6
- package/dist/xlsx/edit/protection.d.ts.map +1 -1
- package/dist/xlsx/edit/types.d.ts +2 -2
- package/dist/xlsx/index.cjs +671 -28
- package/dist/xlsx/index.mjs +670 -29
- package/dist/xlsx/load/index.cjs +56 -19
- package/dist/xlsx/load/index.mjs +56 -19
- package/dist/xlsx/model.d.ts +21 -0
- package/dist/xlsx/model.d.ts.map +1 -1
- package/dist/xlsx/read/load.d.ts.map +1 -1
- package/dist/xlsx/read/password-hash.d.ts +15 -0
- package/dist/xlsx/read/password-hash.d.ts.map +1 -0
- package/dist/xlsx/read/sheet-props.d.ts.map +1 -1
- package/dist/xlsx/read/workbook-part.d.ts +3 -1
- package/dist/xlsx/read/workbook-part.d.ts.map +1 -1
- package/dist/xlsx/write/password-hash.d.ts +8 -0
- package/dist/xlsx/write/password-hash.d.ts.map +1 -0
- package/dist/xlsx/write/sheet-props.d.ts.map +1 -1
- package/dist/xlsx/write/workbook-part.d.ts.map +1 -1
- package/package.json +6 -1
package/dist/index.cjs
CHANGED
|
@@ -1530,6 +1530,603 @@ async function loadDiagram(hostPart, relationshipIds, host) {
|
|
|
1530
1530
|
};
|
|
1531
1531
|
}
|
|
1532
1532
|
|
|
1533
|
+
// src/digest/index.ts
|
|
1534
|
+
var digest_exports = {};
|
|
1535
|
+
__export(digest_exports, {
|
|
1536
|
+
MAX_SPIN_COUNT: () => MAX_SPIN_COUNT,
|
|
1537
|
+
decodeBase64: () => decodeBase64,
|
|
1538
|
+
digestFunction: () => digestFunction,
|
|
1539
|
+
digestSync: () => digestSync,
|
|
1540
|
+
encodeBase64: () => encodeBase64,
|
|
1541
|
+
hashPassword: () => hashPassword,
|
|
1542
|
+
normalizeDigestAlgorithmName: () => normalizeDigestAlgorithmName,
|
|
1543
|
+
sha1: () => sha1,
|
|
1544
|
+
sha256: () => sha256,
|
|
1545
|
+
sha384: () => sha384,
|
|
1546
|
+
sha512: () => sha512,
|
|
1547
|
+
verifyPasswordHash: () => verifyPasswordHash
|
|
1548
|
+
});
|
|
1549
|
+
|
|
1550
|
+
// src/digest/algorithm-names.ts
|
|
1551
|
+
var CANONICAL_BY_LOOKUP_KEY = {
|
|
1552
|
+
SHA1: "SHA-1",
|
|
1553
|
+
SHA256: "SHA-256",
|
|
1554
|
+
SHA384: "SHA-384",
|
|
1555
|
+
SHA512: "SHA-512",
|
|
1556
|
+
MD2: "MD2",
|
|
1557
|
+
MD4: "MD4",
|
|
1558
|
+
MD5: "MD5",
|
|
1559
|
+
RIPEMD128: "RIPEMD-128",
|
|
1560
|
+
RIPEMD160: "RIPEMD-160",
|
|
1561
|
+
WHIRLPOOL: "WHIRLPOOL"
|
|
1562
|
+
};
|
|
1563
|
+
function normalizeDigestAlgorithmName(name) {
|
|
1564
|
+
const key = name.toUpperCase().replace(/[-_\s]/g, "");
|
|
1565
|
+
return Object.hasOwn(CANONICAL_BY_LOOKUP_KEY, key) ? CANONICAL_BY_LOOKUP_KEY[key] : void 0;
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
// src/digest/base64.ts
|
|
1569
|
+
var ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1570
|
+
var VALUES = new Map([...ALPHABET].map((char, index) => [char, index]));
|
|
1571
|
+
function encodeBase64(bytes) {
|
|
1572
|
+
let out = "";
|
|
1573
|
+
for (let i = 0; i < bytes.length; i += 3) {
|
|
1574
|
+
const a = bytes[i];
|
|
1575
|
+
const b = bytes[i + 1];
|
|
1576
|
+
const c = bytes[i + 2];
|
|
1577
|
+
const n = a << 16 | (b ?? 0) << 8 | (c ?? 0);
|
|
1578
|
+
out += ALPHABET[n >> 18] + ALPHABET[n >> 12 & 63];
|
|
1579
|
+
out += b === void 0 ? "=" : ALPHABET[n >> 6 & 63];
|
|
1580
|
+
out += c === void 0 ? "=" : ALPHABET[n & 63];
|
|
1581
|
+
}
|
|
1582
|
+
return out;
|
|
1583
|
+
}
|
|
1584
|
+
function decodeBase64(text) {
|
|
1585
|
+
const compact = text.replace(/\s+/g, "");
|
|
1586
|
+
const body = compact.replace(/={1,2}$/, "");
|
|
1587
|
+
if (body.length % 4 === 1) return void 0;
|
|
1588
|
+
if (compact.length !== body.length && compact.length % 4 !== 0) return void 0;
|
|
1589
|
+
const out = new Uint8Array(Math.floor(body.length * 3 / 4));
|
|
1590
|
+
let bits = 0;
|
|
1591
|
+
let buffer = 0;
|
|
1592
|
+
let index = 0;
|
|
1593
|
+
for (const char of body) {
|
|
1594
|
+
const value = VALUES.get(char);
|
|
1595
|
+
if (value === void 0) return void 0;
|
|
1596
|
+
buffer = (buffer << 6 | value) & 16777215;
|
|
1597
|
+
bits += 6;
|
|
1598
|
+
if (bits >= 8) {
|
|
1599
|
+
bits -= 8;
|
|
1600
|
+
out[index++] = buffer >> bits & 255;
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
return out;
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
// src/digest/sha256.ts
|
|
1607
|
+
var K = new Uint32Array([
|
|
1608
|
+
1116352408,
|
|
1609
|
+
1899447441,
|
|
1610
|
+
3049323471,
|
|
1611
|
+
3921009573,
|
|
1612
|
+
961987163,
|
|
1613
|
+
1508970993,
|
|
1614
|
+
2453635748,
|
|
1615
|
+
2870763221,
|
|
1616
|
+
3624381080,
|
|
1617
|
+
310598401,
|
|
1618
|
+
607225278,
|
|
1619
|
+
1426881987,
|
|
1620
|
+
1925078388,
|
|
1621
|
+
2162078206,
|
|
1622
|
+
2614888103,
|
|
1623
|
+
3248222580,
|
|
1624
|
+
3835390401,
|
|
1625
|
+
4022224774,
|
|
1626
|
+
264347078,
|
|
1627
|
+
604807628,
|
|
1628
|
+
770255983,
|
|
1629
|
+
1249150122,
|
|
1630
|
+
1555081692,
|
|
1631
|
+
1996064986,
|
|
1632
|
+
2554220882,
|
|
1633
|
+
2821834349,
|
|
1634
|
+
2952996808,
|
|
1635
|
+
3210313671,
|
|
1636
|
+
3336571891,
|
|
1637
|
+
3584528711,
|
|
1638
|
+
113926993,
|
|
1639
|
+
338241895,
|
|
1640
|
+
666307205,
|
|
1641
|
+
773529912,
|
|
1642
|
+
1294757372,
|
|
1643
|
+
1396182291,
|
|
1644
|
+
1695183700,
|
|
1645
|
+
1986661051,
|
|
1646
|
+
2177026350,
|
|
1647
|
+
2456956037,
|
|
1648
|
+
2730485921,
|
|
1649
|
+
2820302411,
|
|
1650
|
+
3259730800,
|
|
1651
|
+
3345764771,
|
|
1652
|
+
3516065817,
|
|
1653
|
+
3600352804,
|
|
1654
|
+
4094571909,
|
|
1655
|
+
275423344,
|
|
1656
|
+
430227734,
|
|
1657
|
+
506948616,
|
|
1658
|
+
659060556,
|
|
1659
|
+
883997877,
|
|
1660
|
+
958139571,
|
|
1661
|
+
1322822218,
|
|
1662
|
+
1537002063,
|
|
1663
|
+
1747873779,
|
|
1664
|
+
1955562222,
|
|
1665
|
+
2024104815,
|
|
1666
|
+
2227730452,
|
|
1667
|
+
2361852424,
|
|
1668
|
+
2428436474,
|
|
1669
|
+
2756734187,
|
|
1670
|
+
3204031479,
|
|
1671
|
+
3329325298
|
|
1672
|
+
]);
|
|
1673
|
+
var IV = [
|
|
1674
|
+
1779033703,
|
|
1675
|
+
3144134277,
|
|
1676
|
+
1013904242,
|
|
1677
|
+
2773480762,
|
|
1678
|
+
1359893119,
|
|
1679
|
+
2600822924,
|
|
1680
|
+
528734635,
|
|
1681
|
+
1541459225
|
|
1682
|
+
];
|
|
1683
|
+
var W = new Uint32Array(64);
|
|
1684
|
+
var rotr = (x, n) => x >>> n | x << 32 - n;
|
|
1685
|
+
function compress(h, view, offset) {
|
|
1686
|
+
for (let i = 0; i < 16; i++) W[i] = view.getUint32(offset + i * 4);
|
|
1687
|
+
for (let i = 16; i < 64; i++) {
|
|
1688
|
+
const a2 = W[i - 15];
|
|
1689
|
+
const b2 = W[i - 2];
|
|
1690
|
+
const s0 = rotr(a2, 7) ^ rotr(a2, 18) ^ a2 >>> 3;
|
|
1691
|
+
const s1 = rotr(b2, 17) ^ rotr(b2, 19) ^ b2 >>> 10;
|
|
1692
|
+
W[i] = W[i - 16] + s0 + W[i - 7] + s1 >>> 0;
|
|
1693
|
+
}
|
|
1694
|
+
let a = h[0], b = h[1], c = h[2], d = h[3], e = h[4], f = h[5], g = h[6], k = h[7];
|
|
1695
|
+
for (let i = 0; i < 64; i++) {
|
|
1696
|
+
const S1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
|
|
1697
|
+
const ch = e & f ^ ~e & g;
|
|
1698
|
+
const t1 = k + S1 + ch + K[i] + W[i] >>> 0;
|
|
1699
|
+
const S0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
|
|
1700
|
+
const maj = a & b ^ a & c ^ b & c;
|
|
1701
|
+
const t2 = S0 + maj >>> 0;
|
|
1702
|
+
k = g;
|
|
1703
|
+
g = f;
|
|
1704
|
+
f = e;
|
|
1705
|
+
e = d + t1 >>> 0;
|
|
1706
|
+
d = c;
|
|
1707
|
+
c = b;
|
|
1708
|
+
b = a;
|
|
1709
|
+
a = t1 + t2 >>> 0;
|
|
1710
|
+
}
|
|
1711
|
+
h[0] = h[0] + a >>> 0;
|
|
1712
|
+
h[1] = h[1] + b >>> 0;
|
|
1713
|
+
h[2] = h[2] + c >>> 0;
|
|
1714
|
+
h[3] = h[3] + d >>> 0;
|
|
1715
|
+
h[4] = h[4] + e >>> 0;
|
|
1716
|
+
h[5] = h[5] + f >>> 0;
|
|
1717
|
+
h[6] = h[6] + g >>> 0;
|
|
1718
|
+
h[7] = h[7] + k >>> 0;
|
|
1719
|
+
}
|
|
1720
|
+
function pad64(data) {
|
|
1721
|
+
const padded = new Uint8Array(Math.ceil((data.length + 9) / 64) * 64);
|
|
1722
|
+
padded.set(data);
|
|
1723
|
+
padded[data.length] = 128;
|
|
1724
|
+
const bits = data.length * 8;
|
|
1725
|
+
const view = new DataView(padded.buffer);
|
|
1726
|
+
view.setUint32(padded.length - 8, Math.floor(bits / 4294967296));
|
|
1727
|
+
view.setUint32(padded.length - 4, bits >>> 0);
|
|
1728
|
+
return view;
|
|
1729
|
+
}
|
|
1730
|
+
function wordsOut(h) {
|
|
1731
|
+
const out = new Uint8Array(h.length * 4);
|
|
1732
|
+
const view = new DataView(out.buffer);
|
|
1733
|
+
for (let i = 0; i < h.length; i++) view.setUint32(i * 4, h[i]);
|
|
1734
|
+
return out;
|
|
1735
|
+
}
|
|
1736
|
+
function sha256(data) {
|
|
1737
|
+
const h = new Uint32Array(IV);
|
|
1738
|
+
const view = pad64(data);
|
|
1739
|
+
for (let offset = 0; offset < view.byteLength; offset += 64) compress(h, view, offset);
|
|
1740
|
+
return wordsOut(h);
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
// src/digest/sha1.ts
|
|
1744
|
+
var W2 = new Uint32Array(80);
|
|
1745
|
+
var rotl = (x, n) => x << n | x >>> 32 - n;
|
|
1746
|
+
function compress2(h, view, offset) {
|
|
1747
|
+
for (let i = 0; i < 16; i++) W2[i] = view.getUint32(offset + i * 4);
|
|
1748
|
+
for (let i = 16; i < 80; i++) W2[i] = rotl(W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16], 1);
|
|
1749
|
+
let a = h[0], b = h[1], c = h[2], d = h[3], e = h[4];
|
|
1750
|
+
for (let i = 0; i < 80; i++) {
|
|
1751
|
+
let f;
|
|
1752
|
+
let k;
|
|
1753
|
+
if (i < 20) {
|
|
1754
|
+
f = b & c | ~b & d;
|
|
1755
|
+
k = 1518500249;
|
|
1756
|
+
} else if (i < 40) {
|
|
1757
|
+
f = b ^ c ^ d;
|
|
1758
|
+
k = 1859775393;
|
|
1759
|
+
} else if (i < 60) {
|
|
1760
|
+
f = b & c | b & d | c & d;
|
|
1761
|
+
k = 2400959708;
|
|
1762
|
+
} else {
|
|
1763
|
+
f = b ^ c ^ d;
|
|
1764
|
+
k = 3395469782;
|
|
1765
|
+
}
|
|
1766
|
+
const t = rotl(a, 5) + f + e + k + W2[i] >>> 0;
|
|
1767
|
+
e = d;
|
|
1768
|
+
d = c;
|
|
1769
|
+
c = rotl(b, 30) >>> 0;
|
|
1770
|
+
b = a;
|
|
1771
|
+
a = t;
|
|
1772
|
+
}
|
|
1773
|
+
h[0] = h[0] + a >>> 0;
|
|
1774
|
+
h[1] = h[1] + b >>> 0;
|
|
1775
|
+
h[2] = h[2] + c >>> 0;
|
|
1776
|
+
h[3] = h[3] + d >>> 0;
|
|
1777
|
+
h[4] = h[4] + e >>> 0;
|
|
1778
|
+
}
|
|
1779
|
+
function sha1(data) {
|
|
1780
|
+
const h = new Uint32Array([1732584193, 4023233417, 2562383102, 271733878, 3285377520]);
|
|
1781
|
+
const view = pad64(data);
|
|
1782
|
+
for (let offset = 0; offset < view.byteLength; offset += 64) compress2(h, view, offset);
|
|
1783
|
+
return wordsOut(h);
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
// src/digest/sha512.ts
|
|
1787
|
+
var K2 = new Uint32Array([
|
|
1788
|
+
1116352408,
|
|
1789
|
+
3609767458,
|
|
1790
|
+
1899447441,
|
|
1791
|
+
602891725,
|
|
1792
|
+
3049323471,
|
|
1793
|
+
3964484399,
|
|
1794
|
+
3921009573,
|
|
1795
|
+
2173295548,
|
|
1796
|
+
961987163,
|
|
1797
|
+
4081628472,
|
|
1798
|
+
1508970993,
|
|
1799
|
+
3053834265,
|
|
1800
|
+
2453635748,
|
|
1801
|
+
2937671579,
|
|
1802
|
+
2870763221,
|
|
1803
|
+
3664609560,
|
|
1804
|
+
3624381080,
|
|
1805
|
+
2734883394,
|
|
1806
|
+
310598401,
|
|
1807
|
+
1164996542,
|
|
1808
|
+
607225278,
|
|
1809
|
+
1323610764,
|
|
1810
|
+
1426881987,
|
|
1811
|
+
3590304994,
|
|
1812
|
+
1925078388,
|
|
1813
|
+
4068182383,
|
|
1814
|
+
2162078206,
|
|
1815
|
+
991336113,
|
|
1816
|
+
2614888103,
|
|
1817
|
+
633803317,
|
|
1818
|
+
3248222580,
|
|
1819
|
+
3479774868,
|
|
1820
|
+
3835390401,
|
|
1821
|
+
2666613458,
|
|
1822
|
+
4022224774,
|
|
1823
|
+
944711139,
|
|
1824
|
+
264347078,
|
|
1825
|
+
2341262773,
|
|
1826
|
+
604807628,
|
|
1827
|
+
2007800933,
|
|
1828
|
+
770255983,
|
|
1829
|
+
1495990901,
|
|
1830
|
+
1249150122,
|
|
1831
|
+
1856431235,
|
|
1832
|
+
1555081692,
|
|
1833
|
+
3175218132,
|
|
1834
|
+
1996064986,
|
|
1835
|
+
2198950837,
|
|
1836
|
+
2554220882,
|
|
1837
|
+
3999719339,
|
|
1838
|
+
2821834349,
|
|
1839
|
+
766784016,
|
|
1840
|
+
2952996808,
|
|
1841
|
+
2566594879,
|
|
1842
|
+
3210313671,
|
|
1843
|
+
3203337956,
|
|
1844
|
+
3336571891,
|
|
1845
|
+
1034457026,
|
|
1846
|
+
3584528711,
|
|
1847
|
+
2466948901,
|
|
1848
|
+
113926993,
|
|
1849
|
+
3758326383,
|
|
1850
|
+
338241895,
|
|
1851
|
+
168717936,
|
|
1852
|
+
666307205,
|
|
1853
|
+
1188179964,
|
|
1854
|
+
773529912,
|
|
1855
|
+
1546045734,
|
|
1856
|
+
1294757372,
|
|
1857
|
+
1522805485,
|
|
1858
|
+
1396182291,
|
|
1859
|
+
2643833823,
|
|
1860
|
+
1695183700,
|
|
1861
|
+
2343527390,
|
|
1862
|
+
1986661051,
|
|
1863
|
+
1014477480,
|
|
1864
|
+
2177026350,
|
|
1865
|
+
1206759142,
|
|
1866
|
+
2456956037,
|
|
1867
|
+
344077627,
|
|
1868
|
+
2730485921,
|
|
1869
|
+
1290863460,
|
|
1870
|
+
2820302411,
|
|
1871
|
+
3158454273,
|
|
1872
|
+
3259730800,
|
|
1873
|
+
3505952657,
|
|
1874
|
+
3345764771,
|
|
1875
|
+
106217008,
|
|
1876
|
+
3516065817,
|
|
1877
|
+
3606008344,
|
|
1878
|
+
3600352804,
|
|
1879
|
+
1432725776,
|
|
1880
|
+
4094571909,
|
|
1881
|
+
1467031594,
|
|
1882
|
+
275423344,
|
|
1883
|
+
851169720,
|
|
1884
|
+
430227734,
|
|
1885
|
+
3100823752,
|
|
1886
|
+
506948616,
|
|
1887
|
+
1363258195,
|
|
1888
|
+
659060556,
|
|
1889
|
+
3750685593,
|
|
1890
|
+
883997877,
|
|
1891
|
+
3785050280,
|
|
1892
|
+
958139571,
|
|
1893
|
+
3318307427,
|
|
1894
|
+
1322822218,
|
|
1895
|
+
3812723403,
|
|
1896
|
+
1537002063,
|
|
1897
|
+
2003034995,
|
|
1898
|
+
1747873779,
|
|
1899
|
+
3602036899,
|
|
1900
|
+
1955562222,
|
|
1901
|
+
1575990012,
|
|
1902
|
+
2024104815,
|
|
1903
|
+
1125592928,
|
|
1904
|
+
2227730452,
|
|
1905
|
+
2716904306,
|
|
1906
|
+
2361852424,
|
|
1907
|
+
442776044,
|
|
1908
|
+
2428436474,
|
|
1909
|
+
593698344,
|
|
1910
|
+
2756734187,
|
|
1911
|
+
3733110249,
|
|
1912
|
+
3204031479,
|
|
1913
|
+
2999351573,
|
|
1914
|
+
3329325298,
|
|
1915
|
+
3815920427,
|
|
1916
|
+
3391569614,
|
|
1917
|
+
3928383900,
|
|
1918
|
+
3515267271,
|
|
1919
|
+
566280711,
|
|
1920
|
+
3940187606,
|
|
1921
|
+
3454069534,
|
|
1922
|
+
4118630271,
|
|
1923
|
+
4000239992,
|
|
1924
|
+
116418474,
|
|
1925
|
+
1914138554,
|
|
1926
|
+
174292421,
|
|
1927
|
+
2731055270,
|
|
1928
|
+
289380356,
|
|
1929
|
+
3203993006,
|
|
1930
|
+
460393269,
|
|
1931
|
+
320620315,
|
|
1932
|
+
685471733,
|
|
1933
|
+
587496836,
|
|
1934
|
+
852142971,
|
|
1935
|
+
1086792851,
|
|
1936
|
+
1017036298,
|
|
1937
|
+
365543100,
|
|
1938
|
+
1126000580,
|
|
1939
|
+
2618297676,
|
|
1940
|
+
1288033470,
|
|
1941
|
+
3409855158,
|
|
1942
|
+
1501505948,
|
|
1943
|
+
4234509866,
|
|
1944
|
+
1607167915,
|
|
1945
|
+
987167468,
|
|
1946
|
+
1816402316,
|
|
1947
|
+
1246189591
|
|
1948
|
+
]);
|
|
1949
|
+
var IV_512 = [
|
|
1950
|
+
1779033703,
|
|
1951
|
+
4089235720,
|
|
1952
|
+
3144134277,
|
|
1953
|
+
2227873595,
|
|
1954
|
+
1013904242,
|
|
1955
|
+
4271175723,
|
|
1956
|
+
2773480762,
|
|
1957
|
+
1595750129,
|
|
1958
|
+
1359893119,
|
|
1959
|
+
2917565137,
|
|
1960
|
+
2600822924,
|
|
1961
|
+
725511199,
|
|
1962
|
+
528734635,
|
|
1963
|
+
4215389547,
|
|
1964
|
+
1541459225,
|
|
1965
|
+
327033209
|
|
1966
|
+
];
|
|
1967
|
+
var IV_384 = [
|
|
1968
|
+
3418070365,
|
|
1969
|
+
3238371032,
|
|
1970
|
+
1654270250,
|
|
1971
|
+
914150663,
|
|
1972
|
+
2438529370,
|
|
1973
|
+
812702999,
|
|
1974
|
+
355462360,
|
|
1975
|
+
4144912697,
|
|
1976
|
+
1731405415,
|
|
1977
|
+
4290775857,
|
|
1978
|
+
2394180231,
|
|
1979
|
+
1750603025,
|
|
1980
|
+
3675008525,
|
|
1981
|
+
1694076839,
|
|
1982
|
+
1203062813,
|
|
1983
|
+
3204075428
|
|
1984
|
+
];
|
|
1985
|
+
var W3 = new Uint32Array(160);
|
|
1986
|
+
function compress3(h, data, offset) {
|
|
1987
|
+
for (let i = 0; i < 32; i++) {
|
|
1988
|
+
const o = offset + i * 4;
|
|
1989
|
+
W3[i] = (data[o] << 24 | data[o + 1] << 16 | data[o + 2] << 8 | data[o + 3]) >>> 0;
|
|
1990
|
+
}
|
|
1991
|
+
for (let i = 16; i < 80; i++) {
|
|
1992
|
+
const xh = W3[(i - 15) * 2];
|
|
1993
|
+
const xl = W3[(i - 15) * 2 + 1];
|
|
1994
|
+
const s0h = (xh >>> 1 | xl << 31) ^ (xh >>> 8 | xl << 24) ^ xh >>> 7;
|
|
1995
|
+
const s0l = (xl >>> 1 | xh << 31) ^ (xl >>> 8 | xh << 24) ^ (xl >>> 7 | xh << 25);
|
|
1996
|
+
const yh = W3[(i - 2) * 2];
|
|
1997
|
+
const yl = W3[(i - 2) * 2 + 1];
|
|
1998
|
+
const s1h = (yh >>> 19 | yl << 13) ^ (yl >>> 29 | yh << 3) ^ yh >>> 6;
|
|
1999
|
+
const s1l = (yl >>> 19 | yh << 13) ^ (yh >>> 29 | yl << 3) ^ (yl >>> 6 | yh << 26);
|
|
2000
|
+
let lo = (s0l >>> 0) + (s1l >>> 0) + W3[(i - 7) * 2 + 1] + W3[(i - 16) * 2 + 1];
|
|
2001
|
+
const hi = s0h + s1h + W3[(i - 7) * 2] + W3[(i - 16) * 2] + Math.floor(lo / 4294967296);
|
|
2002
|
+
lo >>>= 0;
|
|
2003
|
+
W3[i * 2] = hi >>> 0;
|
|
2004
|
+
W3[i * 2 + 1] = lo;
|
|
2005
|
+
}
|
|
2006
|
+
let ah = h[0], al = h[1], bh = h[2], bl = h[3], ch = h[4], cl = h[5], dh = h[6], dl = h[7];
|
|
2007
|
+
let eh = h[8], el = h[9], fh = h[10], fl = h[11], gh = h[12], gl = h[13], hh = h[14], hl = h[15];
|
|
2008
|
+
for (let i = 0; i < 80; i++) {
|
|
2009
|
+
const S1h = (eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (el >>> 9 | eh << 23);
|
|
2010
|
+
const S1l = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (eh >>> 9 | el << 23);
|
|
2011
|
+
const chh = eh & fh ^ ~eh & gh;
|
|
2012
|
+
const chl = el & fl ^ ~el & gl;
|
|
2013
|
+
let t1l = (hl >>> 0) + (S1l >>> 0) + (chl >>> 0) + K2[i * 2 + 1] + W3[i * 2 + 1];
|
|
2014
|
+
const t1h = hh + S1h + chh + K2[i * 2] + W3[i * 2] + Math.floor(t1l / 4294967296);
|
|
2015
|
+
t1l >>>= 0;
|
|
2016
|
+
const S0h = (ah >>> 28 | al << 4) ^ (al >>> 2 | ah << 30) ^ (al >>> 7 | ah << 25);
|
|
2017
|
+
const S0l = (al >>> 28 | ah << 4) ^ (ah >>> 2 | al << 30) ^ (ah >>> 7 | al << 25);
|
|
2018
|
+
const majh = ah & bh ^ ah & ch ^ bh & ch;
|
|
2019
|
+
const majl = al & bl ^ al & cl ^ bl & cl;
|
|
2020
|
+
let t2l = (S0l >>> 0) + (majl >>> 0);
|
|
2021
|
+
const t2h = S0h + majh + Math.floor(t2l / 4294967296);
|
|
2022
|
+
t2l >>>= 0;
|
|
2023
|
+
hh = gh;
|
|
2024
|
+
hl = gl;
|
|
2025
|
+
gh = fh;
|
|
2026
|
+
gl = fl;
|
|
2027
|
+
fh = eh;
|
|
2028
|
+
fl = el;
|
|
2029
|
+
let nl = (dl >>> 0) + t1l;
|
|
2030
|
+
eh = dh + t1h + Math.floor(nl / 4294967296) >>> 0;
|
|
2031
|
+
el = nl >>> 0;
|
|
2032
|
+
dh = ch;
|
|
2033
|
+
dl = cl;
|
|
2034
|
+
ch = bh;
|
|
2035
|
+
cl = bl;
|
|
2036
|
+
bh = ah;
|
|
2037
|
+
bl = al;
|
|
2038
|
+
nl = t1l + t2l;
|
|
2039
|
+
ah = t1h + t2h + Math.floor(nl / 4294967296) >>> 0;
|
|
2040
|
+
al = nl >>> 0;
|
|
2041
|
+
}
|
|
2042
|
+
const add = (i, xh, xl) => {
|
|
2043
|
+
const lo = (h[i + 1] >>> 0) + (xl >>> 0);
|
|
2044
|
+
h[i] = h[i] + xh + Math.floor(lo / 4294967296) >>> 0;
|
|
2045
|
+
h[i + 1] = lo >>> 0;
|
|
2046
|
+
};
|
|
2047
|
+
add(0, ah, al);
|
|
2048
|
+
add(2, bh, bl);
|
|
2049
|
+
add(4, ch, cl);
|
|
2050
|
+
add(6, dh, dl);
|
|
2051
|
+
add(8, eh, el);
|
|
2052
|
+
add(10, fh, fl);
|
|
2053
|
+
add(12, gh, gl);
|
|
2054
|
+
add(14, hh, hl);
|
|
2055
|
+
}
|
|
2056
|
+
function digest64(data, iv, bytes) {
|
|
2057
|
+
const h = new Uint32Array(iv);
|
|
2058
|
+
const padded = new Uint8Array(Math.ceil((data.length + 17) / 128) * 128);
|
|
2059
|
+
padded.set(data);
|
|
2060
|
+
padded[data.length] = 128;
|
|
2061
|
+
const bits = data.length * 8;
|
|
2062
|
+
const view = new DataView(padded.buffer);
|
|
2063
|
+
view.setUint32(padded.length - 8, Math.floor(bits / 4294967296));
|
|
2064
|
+
view.setUint32(padded.length - 4, bits >>> 0);
|
|
2065
|
+
for (let offset = 0; offset < padded.length; offset += 128) compress3(h, padded, offset);
|
|
2066
|
+
const out = new Uint8Array(bytes);
|
|
2067
|
+
const outView = new DataView(out.buffer);
|
|
2068
|
+
for (let i = 0; i < bytes / 4; i++) outView.setUint32(i * 4, h[i]);
|
|
2069
|
+
return out;
|
|
2070
|
+
}
|
|
2071
|
+
var sha512 = (data) => digest64(data, IV_512, 64);
|
|
2072
|
+
var sha384 = (data) => digest64(data, IV_384, 48);
|
|
2073
|
+
|
|
2074
|
+
// src/digest/digest.ts
|
|
2075
|
+
var DIGESTS = {
|
|
2076
|
+
"SHA-1": sha1,
|
|
2077
|
+
"SHA-256": sha256,
|
|
2078
|
+
"SHA-384": sha384,
|
|
2079
|
+
"SHA-512": sha512
|
|
2080
|
+
};
|
|
2081
|
+
function digestFunction(name) {
|
|
2082
|
+
const canonical = normalizeDigestAlgorithmName(name);
|
|
2083
|
+
return canonical && canonical in DIGESTS ? DIGESTS[canonical] : void 0;
|
|
2084
|
+
}
|
|
2085
|
+
function digestSync(name, data) {
|
|
2086
|
+
return digestFunction(name)?.(data);
|
|
2087
|
+
}
|
|
2088
|
+
|
|
2089
|
+
// src/digest/password-hash.ts
|
|
2090
|
+
var MAX_SPIN_COUNT = 1e7;
|
|
2091
|
+
var validSpinCount = (spinCount) => spinCount === void 0 || Number.isInteger(spinCount) && spinCount >= 0 && spinCount <= MAX_SPIN_COUNT;
|
|
2092
|
+
function spin(password, salt, spinCount, digest) {
|
|
2093
|
+
const input = new Uint8Array(salt.length + password.length * 2);
|
|
2094
|
+
input.set(salt);
|
|
2095
|
+
for (let i = 0; i < password.length; i++) {
|
|
2096
|
+
const code = password.charCodeAt(i);
|
|
2097
|
+
input[salt.length + i * 2] = code & 255;
|
|
2098
|
+
input[salt.length + i * 2 + 1] = code >> 8;
|
|
2099
|
+
}
|
|
2100
|
+
let value = digest(input);
|
|
2101
|
+
const buffer = new Uint8Array(value.length + 4);
|
|
2102
|
+
const view = new DataView(buffer.buffer);
|
|
2103
|
+
for (let i = 0; i < spinCount; i++) {
|
|
2104
|
+
buffer.set(value);
|
|
2105
|
+
view.setUint32(value.length, i, true);
|
|
2106
|
+
value = digest(buffer);
|
|
2107
|
+
}
|
|
2108
|
+
return value;
|
|
2109
|
+
}
|
|
2110
|
+
function hashBytes(password, { algorithmName, saltValue, spinCount }) {
|
|
2111
|
+
const digest = digestFunction(algorithmName);
|
|
2112
|
+
const salt = decodeBase64(saltValue);
|
|
2113
|
+
if (!digest || !salt || !validSpinCount(spinCount)) return void 0;
|
|
2114
|
+
return spin(password, salt, spinCount ?? 0, digest);
|
|
2115
|
+
}
|
|
2116
|
+
function hashPassword(password, options) {
|
|
2117
|
+
const bytes = hashBytes(password, options);
|
|
2118
|
+
return bytes && encodeBase64(bytes);
|
|
2119
|
+
}
|
|
2120
|
+
function verifyPasswordHash(password, hash) {
|
|
2121
|
+
if (!digestFunction(hash.algorithmName)) return void 0;
|
|
2122
|
+
const expected = decodeBase64(hash.hashValue);
|
|
2123
|
+
const actual = expected && hashBytes(password, hash);
|
|
2124
|
+
if (!expected || !actual || actual.length !== expected.length) return false;
|
|
2125
|
+
let difference = 0;
|
|
2126
|
+
for (let i = 0; i < actual.length; i++) difference |= actual[i] ^ expected[i];
|
|
2127
|
+
return difference === 0;
|
|
2128
|
+
}
|
|
2129
|
+
|
|
1533
2130
|
// src/geometry/index.ts
|
|
1534
2131
|
var geometry_exports = {};
|
|
1535
2132
|
__export(geometry_exports, {
|
|
@@ -18673,6 +19270,7 @@ function parseOmml(xml) {
|
|
|
18673
19270
|
|
|
18674
19271
|
exports.color = color_exports;
|
|
18675
19272
|
exports.diagram = diagram_exports;
|
|
19273
|
+
exports.digest = digest_exports;
|
|
18676
19274
|
exports.geometry = geometry_exports;
|
|
18677
19275
|
exports.math = math_exports;
|
|
18678
19276
|
exports.opc = opc_exports;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * as color from './color/index.js';
|
|
2
2
|
export * as diagram from './diagram/index.js';
|
|
3
|
+
export * as digest from './digest/index.js';
|
|
3
4
|
export * as geometry from './geometry/index.js';
|
|
4
5
|
export * as opc from './opc/index.js';
|
|
5
6
|
export * as units from './units/index.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAC;AACtC,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAC;AACtC,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC"}
|