@argent/x-shared 1.75.5 → 1.75.6

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.
Files changed (27) hide show
  1. package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/_md.cjs +1 -0
  2. package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/_md.js +85 -0
  3. package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/_u64.cjs +1 -0
  4. package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/_u64.js +22 -0
  5. package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/sha2.cjs +1 -0
  6. package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/sha2.js +124 -0
  7. package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/sha3.cjs +1 -0
  8. package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/sha3.js +118 -0
  9. package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/utils.cjs +1 -0
  10. package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/utils.js +92 -0
  11. package/dist/src/accountNameGenerator/index.cjs +1 -1
  12. package/dist/src/accountNameGenerator/index.js +1 -1
  13. package/dist/src/utils/id.cjs +1 -1
  14. package/dist/src/utils/id.js +2 -2
  15. package/package.json +6 -6
  16. package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/_assert.cjs +0 -1
  17. package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/_assert.js +0 -32
  18. package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/_md.cjs +0 -1
  19. package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/_md.js +0 -64
  20. package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/_u64.cjs +0 -1
  21. package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/_u64.js +0 -21
  22. package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/sha256.cjs +0 -1
  23. package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/sha256.js +0 -115
  24. package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/sha3.cjs +0 -1
  25. package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/sha3.js +0 -107
  26. package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/utils.cjs +0 -1
  27. package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/utils.js +0 -46
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./utils.cjs");function b(u,t,s){return u&t^~u&s}function p(u,t,s){return u&t^u&s^t&s}class d{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,s,n,i){this.blockLen=t,this.outputLen=s,this.padOffset=n,this.isLE=i,this.buffer=new Uint8Array(t),this.view=f.createView(this.buffer)}update(t){f.aexists(this),f.abytes(t);const{view:s,buffer:n,blockLen:i}=this,r=t.length;for(let e=0;e<r;){const o=Math.min(i-this.pos,r-e);if(o===i){const c=f.createView(t);for(;i<=r-e;e+=i)this.process(c,e);continue}n.set(t.subarray(e,e+o),this.pos),this.pos+=o,e+=o,this.pos===i&&(this.process(s,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){f.aexists(this),f.aoutput(t,this),this.finished=!0;const{buffer:s,view:n,blockLen:i,isLE:r}=this;let{pos:e}=this;s[e++]=128,f.clean(this.buffer.subarray(e)),this.padOffset>i-e&&(this.process(n,0),e=0);for(let h=e;h<i;h++)s[h]=0;n.setBigUint64(i-8,BigInt(this.length*8),r),this.process(n,0);const o=f.createView(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const a=c/4,l=this.get();if(a>l.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<a;h++)o.setUint32(4*h,l[h],r)}digest(){const{buffer:t,outputLen:s}=this;this.digestInto(t);const n=t.slice(0,s);return this.destroy(),n}_cloneInto(t){t||=new this.constructor,t.set(...this.get());const{blockLen:s,buffer:n,length:i,finished:r,destroyed:e,pos:o}=this;return t.destroyed=e,t.finished=r,t.length=i,t.pos=o,i%s&&t.buffer.set(n),t}clone(){return this._cloneInto()}}const g=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);exports.Chi=b;exports.HashMD=d;exports.Maj=p;exports.SHA256_IV=g;
@@ -0,0 +1,85 @@
1
+ import { createView as c, aexists as a, abytes as b, aoutput as d, clean as g } from "./utils.js";
2
+ function w(f, t, e) {
3
+ return f & t ^ ~f & e;
4
+ }
5
+ function x(f, t, e) {
6
+ return f & t ^ f & e ^ t & e;
7
+ }
8
+ class y {
9
+ blockLen;
10
+ outputLen;
11
+ padOffset;
12
+ isLE;
13
+ // For partial updates less than block size
14
+ buffer;
15
+ view;
16
+ finished = !1;
17
+ length = 0;
18
+ pos = 0;
19
+ destroyed = !1;
20
+ constructor(t, e, n, i) {
21
+ this.blockLen = t, this.outputLen = e, this.padOffset = n, this.isLE = i, this.buffer = new Uint8Array(t), this.view = c(this.buffer);
22
+ }
23
+ update(t) {
24
+ a(this), b(t);
25
+ const { view: e, buffer: n, blockLen: i } = this, o = t.length;
26
+ for (let s = 0; s < o; ) {
27
+ const r = Math.min(i - this.pos, o - s);
28
+ if (r === i) {
29
+ const u = c(t);
30
+ for (; i <= o - s; s += i)
31
+ this.process(u, s);
32
+ continue;
33
+ }
34
+ n.set(t.subarray(s, s + r), this.pos), this.pos += r, s += r, this.pos === i && (this.process(e, 0), this.pos = 0);
35
+ }
36
+ return this.length += t.length, this.roundClean(), this;
37
+ }
38
+ digestInto(t) {
39
+ a(this), d(t, this), this.finished = !0;
40
+ const { buffer: e, view: n, blockLen: i, isLE: o } = this;
41
+ let { pos: s } = this;
42
+ e[s++] = 128, g(this.buffer.subarray(s)), this.padOffset > i - s && (this.process(n, 0), s = 0);
43
+ for (let h = s; h < i; h++)
44
+ e[h] = 0;
45
+ n.setBigUint64(i - 8, BigInt(this.length * 8), o), this.process(n, 0);
46
+ const r = c(t), u = this.outputLen;
47
+ if (u % 4)
48
+ throw new Error("_sha2: outputLen must be aligned to 32bit");
49
+ const l = u / 4, p = this.get();
50
+ if (l > p.length)
51
+ throw new Error("_sha2: outputLen bigger than state");
52
+ for (let h = 0; h < l; h++)
53
+ r.setUint32(4 * h, p[h], o);
54
+ }
55
+ digest() {
56
+ const { buffer: t, outputLen: e } = this;
57
+ this.digestInto(t);
58
+ const n = t.slice(0, e);
59
+ return this.destroy(), n;
60
+ }
61
+ _cloneInto(t) {
62
+ t ||= new this.constructor(), t.set(...this.get());
63
+ const { blockLen: e, buffer: n, length: i, finished: o, destroyed: s, pos: r } = this;
64
+ return t.destroyed = s, t.finished = o, t.length = i, t.pos = r, i % e && t.buffer.set(n), t;
65
+ }
66
+ clone() {
67
+ return this._cloneInto();
68
+ }
69
+ }
70
+ const I = /* @__PURE__ */ Uint32Array.from([
71
+ 1779033703,
72
+ 3144134277,
73
+ 1013904242,
74
+ 2773480762,
75
+ 1359893119,
76
+ 2600822924,
77
+ 528734635,
78
+ 1541459225
79
+ ]);
80
+ export {
81
+ w as Chi,
82
+ y as HashMD,
83
+ x as Maj,
84
+ I as SHA256_IV
85
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=BigInt(2**32-1),c=BigInt(32);function u(t,o=!1){return o?{h:Number(t&l),l:Number(t>>c&l)}:{h:Number(t>>c&l)|0,l:Number(t&l)|0}}function B(t,o=!1){const r=t.length;let n=new Uint32Array(r),i=new Uint32Array(r);for(let e=0;e<r;e++){const{h:f,l:s}=u(t[e],o);[n[e],i[e]]=[f,s]}return[n,i]}const g=(t,o,r)=>t<<r|o>>>32-r,m=(t,o,r)=>o<<r|t>>>32-r,S=(t,o,r)=>o<<r-32|t>>>64-r,a=(t,o,r)=>t<<r-32|o>>>64-r;exports.fromBig=u;exports.rotlBH=S;exports.rotlBL=a;exports.rotlSH=g;exports.rotlSL=m;exports.split=B;
@@ -0,0 +1,22 @@
1
+ const o = /* @__PURE__ */ BigInt(4294967295), i = /* @__PURE__ */ BigInt(32);
2
+ function s(t, r = !1) {
3
+ return r ? { h: Number(t & o), l: Number(t >> i & o) } : { h: Number(t >> i & o) | 0, l: Number(t & o) | 0 };
4
+ }
5
+ function h(t, r = !1) {
6
+ const n = t.length;
7
+ let l = new Uint32Array(n), c = new Uint32Array(n);
8
+ for (let e = 0; e < n; e++) {
9
+ const { h: u, l: f } = s(t[e], r);
10
+ [l[e], c[e]] = [u, f];
11
+ }
12
+ return [l, c];
13
+ }
14
+ const m = (t, r, n) => t << n | r >>> 32 - n, A = (t, r, n) => r << n | t >>> 32 - n, B = (t, r, n) => r << n - 32 | t >>> 64 - n, a = (t, r, n) => t << n - 32 | r >>> 64 - n;
15
+ export {
16
+ s as fromBig,
17
+ B as rotlBH,
18
+ a as rotlBL,
19
+ m as rotlSH,
20
+ A as rotlSL,
21
+ h as split
22
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./_md.cjs"),c=require("./utils.cjs"),I=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),b=new Uint32Array(64);class V extends e.HashMD{constructor(f){super(64,f,8,!1)}get(){const{A:f,B:n,C:x,D:a,E:r,F:o,G:s,H:i}=this;return[f,n,x,a,r,o,s,i]}set(f,n,x,a,r,o,s,i){this.A=f|0,this.B=n|0,this.C=x|0,this.D=a|0,this.E=r|0,this.F=o|0,this.G=s|0,this.H=i|0}process(f,n){for(let t=0;t<16;t++,n+=4)b[t]=f.getUint32(n,!1);for(let t=16;t<64;t++){const H=b[t-15],h=b[t-2],S=c.rotr(H,7)^c.rotr(H,18)^H>>>3,l=c.rotr(h,17)^c.rotr(h,19)^h>>>10;b[t]=l+b[t-7]+S+b[t-16]|0}let{A:x,B:a,C:r,D:o,E:s,F:i,G:d,H:A}=this;for(let t=0;t<64;t++){const H=c.rotr(s,6)^c.rotr(s,11)^c.rotr(s,25),h=A+H+e.Chi(s,i,d)+I[t]+b[t]|0,l=(c.rotr(x,2)^c.rotr(x,13)^c.rotr(x,22))+e.Maj(x,a,r)|0;A=d,d=i,i=s,s=o+h|0,o=r,r=a,a=x,x=h+l|0}x=x+this.A|0,a=a+this.B|0,r=r+this.C|0,o=o+this.D|0,s=s+this.E|0,i=i+this.F|0,d=d+this.G|0,A=A+this.H|0,this.set(x,a,r,o,s,i,d,A)}roundClean(){c.clean(b)}destroy(){this.set(0,0,0,0,0,0,0,0),c.clean(this.buffer)}}class _ extends V{A=e.SHA256_IV[0]|0;B=e.SHA256_IV[1]|0;C=e.SHA256_IV[2]|0;D=e.SHA256_IV[3]|0;E=e.SHA256_IV[4]|0;F=e.SHA256_IV[5]|0;G=e.SHA256_IV[6]|0;H=e.SHA256_IV[7]|0;constructor(){super(32)}}const g=c.createHasher(()=>new _,c.oidNist(1));exports._SHA256=_;exports.sha256=g;
@@ -0,0 +1,124 @@
1
+ import { SHA256_IV as i, HashMD as p, Chi as B, Maj as D } from "./_md.js";
2
+ import { createHasher as g, oidNist as E, clean as u, rotr as f } from "./utils.js";
3
+ const F = /* @__PURE__ */ Uint32Array.from([
4
+ 1116352408,
5
+ 1899447441,
6
+ 3049323471,
7
+ 3921009573,
8
+ 961987163,
9
+ 1508970993,
10
+ 2453635748,
11
+ 2870763221,
12
+ 3624381080,
13
+ 310598401,
14
+ 607225278,
15
+ 1426881987,
16
+ 1925078388,
17
+ 2162078206,
18
+ 2614888103,
19
+ 3248222580,
20
+ 3835390401,
21
+ 4022224774,
22
+ 264347078,
23
+ 604807628,
24
+ 770255983,
25
+ 1249150122,
26
+ 1555081692,
27
+ 1996064986,
28
+ 2554220882,
29
+ 2821834349,
30
+ 2952996808,
31
+ 3210313671,
32
+ 3336571891,
33
+ 3584528711,
34
+ 113926993,
35
+ 338241895,
36
+ 666307205,
37
+ 773529912,
38
+ 1294757372,
39
+ 1396182291,
40
+ 1695183700,
41
+ 1986661051,
42
+ 2177026350,
43
+ 2456956037,
44
+ 2730485921,
45
+ 2820302411,
46
+ 3259730800,
47
+ 3345764771,
48
+ 3516065817,
49
+ 3600352804,
50
+ 4094571909,
51
+ 275423344,
52
+ 430227734,
53
+ 506948616,
54
+ 659060556,
55
+ 883997877,
56
+ 958139571,
57
+ 1322822218,
58
+ 1537002063,
59
+ 1747873779,
60
+ 1955562222,
61
+ 2024104815,
62
+ 2227730452,
63
+ 2361852424,
64
+ 2428436474,
65
+ 2756734187,
66
+ 3204031479,
67
+ 3329325298
68
+ ]), o = /* @__PURE__ */ new Uint32Array(64);
69
+ class G extends p {
70
+ constructor(r) {
71
+ super(64, r, 8, !1);
72
+ }
73
+ get() {
74
+ const { A: r, B: h, C: c, D: t, E: e, F: b, G: s, H: a } = this;
75
+ return [r, h, c, t, e, b, s, a];
76
+ }
77
+ // prettier-ignore
78
+ set(r, h, c, t, e, b, s, a) {
79
+ this.A = r | 0, this.B = h | 0, this.C = c | 0, this.D = t | 0, this.E = e | 0, this.F = b | 0, this.G = s | 0, this.H = a | 0;
80
+ }
81
+ process(r, h) {
82
+ for (let x = 0; x < 16; x++, h += 4)
83
+ o[x] = r.getUint32(h, !1);
84
+ for (let x = 16; x < 64; x++) {
85
+ const H = o[x - 15], d = o[x - 2], m = f(H, 7) ^ f(H, 18) ^ H >>> 3, l = f(d, 17) ^ f(d, 19) ^ d >>> 10;
86
+ o[x] = l + o[x - 7] + m + o[x - 16] | 0;
87
+ }
88
+ let { A: c, B: t, C: e, D: b, E: s, F: a, G: n, H: A } = this;
89
+ for (let x = 0; x < 64; x++) {
90
+ const H = f(s, 6) ^ f(s, 11) ^ f(s, 25), d = A + H + B(s, a, n) + F[x] + o[x] | 0, l = (f(c, 2) ^ f(c, 13) ^ f(c, 22)) + D(c, t, e) | 0;
91
+ A = n, n = a, a = s, s = b + d | 0, b = e, e = t, t = c, c = d + l | 0;
92
+ }
93
+ c = c + this.A | 0, t = t + this.B | 0, e = e + this.C | 0, b = b + this.D | 0, s = s + this.E | 0, a = a + this.F | 0, n = n + this.G | 0, A = A + this.H | 0, this.set(c, t, e, b, s, a, n, A);
94
+ }
95
+ roundClean() {
96
+ u(o);
97
+ }
98
+ destroy() {
99
+ this.set(0, 0, 0, 0, 0, 0, 0, 0), u(this.buffer);
100
+ }
101
+ }
102
+ class S extends G {
103
+ // We cannot use array here since array allows indexing by variable
104
+ // which means optimizer/compiler cannot use registers.
105
+ A = i[0] | 0;
106
+ B = i[1] | 0;
107
+ C = i[2] | 0;
108
+ D = i[3] | 0;
109
+ E = i[4] | 0;
110
+ F = i[5] | 0;
111
+ G = i[6] | 0;
112
+ H = i[7] | 0;
113
+ constructor() {
114
+ super(32);
115
+ }
116
+ }
117
+ const U = /* @__PURE__ */ g(
118
+ () => new S(),
119
+ /* @__PURE__ */ E(1)
120
+ );
121
+ export {
122
+ S as _SHA256,
123
+ U as sha256
124
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./_u64.cjs"),h=require("./utils.cjs"),B=BigInt(0),u=BigInt(1),A=BigInt(2),H=BigInt(7),S=BigInt(256),T=BigInt(113),O=[],y=[],w=[];for(let n=0,t=u,s=1,i=0;n<24;n++){[s,i]=[i,(2*s+3*i)%5],O.push(2*(5*i+s)),y.push((n+1)*(n+2)/2%64);let o=B;for(let r=0;r<7;r++)t=(t<<u^(t>>H)*T)%S,t&A&&(o^=u<<(u<<BigInt(r))-u);w.push(o)}const _=f.split(w,!0),F=_[0],X=_[1],I=(n,t,s)=>s>32?f.rotlBH(n,t,s):f.rotlSH(n,t,s),x=(n,t,s)=>s>32?f.rotlBL(n,t,s):f.rotlSL(n,t,s);function b(n,t=24){const s=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let e=0;e<10;e++)s[e]=n[e]^n[e+10]^n[e+20]^n[e+30]^n[e+40];for(let e=0;e<10;e+=2){const c=(e+8)%10,l=(e+2)%10,p=s[l],a=s[l+1],g=I(p,a,1)^s[c],L=x(p,a,1)^s[c+1];for(let d=0;d<50;d+=10)n[e+d]^=g,n[e+d+1]^=L}let o=n[2],r=n[3];for(let e=0;e<24;e++){const c=y[e],l=I(o,r,c),p=x(o,r,c),a=O[e];o=n[a],r=n[a+1],n[a]=l,n[a+1]=p}for(let e=0;e<50;e+=10){for(let c=0;c<10;c++)s[c]=n[e+c];for(let c=0;c<10;c++)n[e+c]^=~s[(c+2)%10]&s[(c+4)%10]}n[0]^=F[i],n[1]^=X[i]}h.clean(s)}class k{state;pos=0;posOut=0;finished=!1;state32;destroyed=!1;blockLen;suffix;outputLen;enableXOF=!1;rounds;constructor(t,s,i,o=!1,r=24){if(this.blockLen=t,this.suffix=s,this.outputLen=i,this.enableXOF=o,this.rounds=r,h.anumber(i,"outputLen"),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=h.u32(this.state)}clone(){return this._cloneInto()}keccak(){h.swap32IfBE(this.state32),b(this.state32,this.rounds),h.swap32IfBE(this.state32),this.posOut=0,this.pos=0}update(t){h.aexists(this),h.abytes(t);const{blockLen:s,state:i}=this,o=t.length;for(let r=0;r<o;){const e=Math.min(s-this.pos,o-r);for(let c=0;c<e;c++)i[this.pos++]^=t[r++];this.pos===s&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:s,pos:i,blockLen:o}=this;t[i]^=s,(s&128)!==0&&i===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){h.aexists(this,!1),h.abytes(t),this.finish();const s=this.state,{blockLen:i}=this;for(let o=0,r=t.length;o<r;){this.posOut>=i&&this.keccak();const e=Math.min(i-this.posOut,r-o);t.set(s.subarray(this.posOut,this.posOut+e),o),this.posOut+=e,o+=e}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return h.anumber(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(h.aoutput(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,h.clean(this.state)}_cloneInto(t){const{blockLen:s,suffix:i,outputLen:o,rounds:r,enableXOF:e}=this;return t||=new k(s,i,o,e,r),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=r,t.suffix=i,t.outputLen=o,t.enableXOF=e,t.destroyed=this.destroyed,t}}const m=(n,t,s,i={})=>h.createHasher(()=>new k(t,n,s),i),E=m(1,136,32);exports.Keccak=k;exports.keccakP=b;exports.keccak_256=E;
@@ -0,0 +1,118 @@
1
+ import { split as H, rotlSH as T, rotlSL as S, rotlBH as m, rotlBL as F } from "./_u64.js";
2
+ import { createHasher as X, anumber as d, u32 as E, swap32IfBE as k, aexists as I, abytes as x, aoutput as U, clean as y } from "./utils.js";
3
+ const P = BigInt(0), f = BigInt(1), M = BigInt(2), R = BigInt(7), j = BigInt(256), K = BigInt(113), _ = [], L = [], g = [];
4
+ for (let n = 0, t = f, s = 1, i = 0; n < 24; n++) {
5
+ [s, i] = [i, (2 * s + 3 * i) % 5], _.push(2 * (5 * i + s)), L.push((n + 1) * (n + 2) / 2 % 64);
6
+ let o = P;
7
+ for (let r = 0; r < 7; r++)
8
+ t = (t << f ^ (t >> R) * K) % j, t & M && (o ^= f << (f << BigInt(r)) - f);
9
+ g.push(o);
10
+ }
11
+ const b = H(g, !0), q = b[0], v = b[1], O = (n, t, s) => s > 32 ? m(n, t, s) : T(n, t, s), w = (n, t, s) => s > 32 ? F(n, t, s) : S(n, t, s);
12
+ function z(n, t = 24) {
13
+ const s = new Uint32Array(10);
14
+ for (let i = 24 - t; i < 24; i++) {
15
+ for (let e = 0; e < 10; e++)
16
+ s[e] = n[e] ^ n[e + 10] ^ n[e + 20] ^ n[e + 30] ^ n[e + 40];
17
+ for (let e = 0; e < 10; e += 2) {
18
+ const h = (e + 8) % 10, u = (e + 2) % 10, a = s[u], c = s[u + 1], A = O(a, c, 1) ^ s[h], B = w(a, c, 1) ^ s[h + 1];
19
+ for (let l = 0; l < 50; l += 10)
20
+ n[e + l] ^= A, n[e + l + 1] ^= B;
21
+ }
22
+ let o = n[2], r = n[3];
23
+ for (let e = 0; e < 24; e++) {
24
+ const h = L[e], u = O(o, r, h), a = w(o, r, h), c = _[e];
25
+ o = n[c], r = n[c + 1], n[c] = u, n[c + 1] = a;
26
+ }
27
+ for (let e = 0; e < 50; e += 10) {
28
+ for (let h = 0; h < 10; h++)
29
+ s[h] = n[e + h];
30
+ for (let h = 0; h < 10; h++)
31
+ n[e + h] ^= ~s[(h + 2) % 10] & s[(h + 4) % 10];
32
+ }
33
+ n[0] ^= q[i], n[1] ^= v[i];
34
+ }
35
+ y(s);
36
+ }
37
+ class p {
38
+ state;
39
+ pos = 0;
40
+ posOut = 0;
41
+ finished = !1;
42
+ state32;
43
+ destroyed = !1;
44
+ blockLen;
45
+ suffix;
46
+ outputLen;
47
+ enableXOF = !1;
48
+ rounds;
49
+ // NOTE: we accept arguments in bytes instead of bits here.
50
+ constructor(t, s, i, o = !1, r = 24) {
51
+ if (this.blockLen = t, this.suffix = s, this.outputLen = i, this.enableXOF = o, this.rounds = r, d(i, "outputLen"), !(0 < t && t < 200))
52
+ throw new Error("only keccak-f1600 function is supported");
53
+ this.state = new Uint8Array(200), this.state32 = E(this.state);
54
+ }
55
+ clone() {
56
+ return this._cloneInto();
57
+ }
58
+ keccak() {
59
+ k(this.state32), z(this.state32, this.rounds), k(this.state32), this.posOut = 0, this.pos = 0;
60
+ }
61
+ update(t) {
62
+ I(this), x(t);
63
+ const { blockLen: s, state: i } = this, o = t.length;
64
+ for (let r = 0; r < o; ) {
65
+ const e = Math.min(s - this.pos, o - r);
66
+ for (let h = 0; h < e; h++)
67
+ i[this.pos++] ^= t[r++];
68
+ this.pos === s && this.keccak();
69
+ }
70
+ return this;
71
+ }
72
+ finish() {
73
+ if (this.finished)
74
+ return;
75
+ this.finished = !0;
76
+ const { state: t, suffix: s, pos: i, blockLen: o } = this;
77
+ t[i] ^= s, (s & 128) !== 0 && i === o - 1 && this.keccak(), t[o - 1] ^= 128, this.keccak();
78
+ }
79
+ writeInto(t) {
80
+ I(this, !1), x(t), this.finish();
81
+ const s = this.state, { blockLen: i } = this;
82
+ for (let o = 0, r = t.length; o < r; ) {
83
+ this.posOut >= i && this.keccak();
84
+ const e = Math.min(i - this.posOut, r - o);
85
+ t.set(s.subarray(this.posOut, this.posOut + e), o), this.posOut += e, o += e;
86
+ }
87
+ return t;
88
+ }
89
+ xofInto(t) {
90
+ if (!this.enableXOF)
91
+ throw new Error("XOF is not possible for this instance");
92
+ return this.writeInto(t);
93
+ }
94
+ xof(t) {
95
+ return d(t), this.xofInto(new Uint8Array(t));
96
+ }
97
+ digestInto(t) {
98
+ if (U(t, this), this.finished)
99
+ throw new Error("digest() was already called");
100
+ return this.writeInto(t), this.destroy(), t;
101
+ }
102
+ digest() {
103
+ return this.digestInto(new Uint8Array(this.outputLen));
104
+ }
105
+ destroy() {
106
+ this.destroyed = !0, y(this.state);
107
+ }
108
+ _cloneInto(t) {
109
+ const { blockLen: s, suffix: i, outputLen: o, rounds: r, enableXOF: e } = this;
110
+ return t ||= new p(s, i, o, e, r), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = r, t.suffix = i, t.outputLen = o, t.enableXOF = e, t.destroyed = this.destroyed, t;
111
+ }
112
+ }
113
+ const C = (n, t, s, i = {}) => X(() => new p(t, n, s), i), J = /* @__PURE__ */ C(1, 136, 32);
114
+ export {
115
+ p as Keccak,
116
+ z as keccakP,
117
+ J as keccak_256
118
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function u(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function p(e,t=""){if(!Number.isSafeInteger(e)||e<0){const n=t&&`"${t}" `;throw new Error(`${n}expected integer >0, got ${e}`)}}function i(e,t,n=""){const r=u(e),o=e?.length;if(!r||t!==void 0){const y=n&&`"${n}" `,x="",d=r?`length=${o}`:`type=${typeof e}`;throw new Error(y+"expected Uint8Array"+x+", got "+d)}return e}function b(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function g(e,t){i(e,void 0,"digestInto() output");const n=t.outputLen;if(e.length<n)throw new Error('"digestInto() output" expected to be of length >='+n)}function h(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function w(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function l(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function A(e,t){return e<<32-t|e>>>t}const s=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function c(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function a(e){for(let t=0;t<e.length;t++)e[t]=c(e[t]);return e}const L=s?e=>e:a,m=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",E=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function H(e){if(i(e),m)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=E[e[n]];return t}function U(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function S(e,t={}){const n=(o,f)=>e(f).update(o).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.create=o=>e(o),Object.assign(n,t),Object.freeze(n)}const B=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});exports.abytes=i;exports.aexists=b;exports.anumber=p;exports.aoutput=g;exports.byteSwap=c;exports.byteSwap32=a;exports.bytesToHex=H;exports.clean=w;exports.createHasher=S;exports.createView=l;exports.isBytes=u;exports.isLE=s;exports.oidNist=B;exports.rotr=A;exports.swap32IfBE=L;exports.u32=h;exports.utf8ToBytes=U;
@@ -0,0 +1,92 @@
1
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2
+ function x(e) {
3
+ return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
4
+ }
5
+ function h(e, t = "") {
6
+ if (!Number.isSafeInteger(e) || e < 0) {
7
+ const n = t && `"${t}" `;
8
+ throw new Error(`${n}expected integer >0, got ${e}`);
9
+ }
10
+ }
11
+ function i(e, t, n = "") {
12
+ const r = x(e), o = e?.length;
13
+ if (!r || t !== void 0) {
14
+ const u = n && `"${n}" `, c = "", s = r ? `length=${o}` : `type=${typeof e}`;
15
+ throw new Error(u + "expected Uint8Array" + c + ", got " + s);
16
+ }
17
+ return e;
18
+ }
19
+ function w(e, t = !0) {
20
+ if (e.destroyed)
21
+ throw new Error("Hash instance has been destroyed");
22
+ if (t && e.finished)
23
+ throw new Error("Hash#digest() has already been called");
24
+ }
25
+ function b(e, t) {
26
+ i(e, void 0, "digestInto() output");
27
+ const n = t.outputLen;
28
+ if (e.length < n)
29
+ throw new Error('"digestInto() output" expected to be of length >=' + n);
30
+ }
31
+ function l(e) {
32
+ return new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4));
33
+ }
34
+ function A(...e) {
35
+ for (let t = 0; t < e.length; t++)
36
+ e[t].fill(0);
37
+ }
38
+ function L(e) {
39
+ return new DataView(e.buffer, e.byteOffset, e.byteLength);
40
+ }
41
+ function U(e, t) {
42
+ return e << 32 - t | e >>> t;
43
+ }
44
+ const a = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
45
+ function y(e) {
46
+ return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
47
+ }
48
+ function d(e) {
49
+ for (let t = 0; t < e.length; t++)
50
+ e[t] = y(e[t]);
51
+ return e;
52
+ }
53
+ const m = a ? (e) => e : d, p = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", g = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
54
+ function E(e) {
55
+ if (i(e), p)
56
+ return e.toHex();
57
+ let t = "";
58
+ for (let n = 0; n < e.length; n++)
59
+ t += g[e[n]];
60
+ return t;
61
+ }
62
+ function H(e) {
63
+ if (typeof e != "string")
64
+ throw new Error("string expected");
65
+ return new Uint8Array(new TextEncoder().encode(e));
66
+ }
67
+ function $(e, t = {}) {
68
+ const n = (o, f) => e(f).update(o).digest(), r = e(void 0);
69
+ return n.outputLen = r.outputLen, n.blockLen = r.blockLen, n.create = (o) => e(o), Object.assign(n, t), Object.freeze(n);
70
+ }
71
+ const B = (e) => ({
72
+ oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, e])
73
+ });
74
+ export {
75
+ i as abytes,
76
+ w as aexists,
77
+ h as anumber,
78
+ b as aoutput,
79
+ y as byteSwap,
80
+ d as byteSwap32,
81
+ E as bytesToHex,
82
+ A as clean,
83
+ $ as createHasher,
84
+ L as createView,
85
+ x as isBytes,
86
+ a as isLE,
87
+ B as oidNist,
88
+ U as rotr,
89
+ m as swap32IfBE,
90
+ l as u32,
91
+ H as utf8ToBytes
92
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/sha256.cjs"),h=require("lodash-es"),d=require("./colors.cjs"),l=require("./x-names.json.cjs");class m{constructor(t,e){this.nameList=t||l.default,this.colorList=e||d.nameDataColors}generate(t){const e=this.hashSeed(t),n=e.getUint32(0)%this.nameList.items.length,s=this.nameList.items[n],o=e.getUint32(4)%s.adjectives.length,i=s.adjectives[o],r=e.getUint32(8)%this.colorList.length,c=this.colorList[r];return{name:`${h.upperFirst(i)} ${s.name}`,emoji:s.emoji,color:c}}hashSeed(t){const e=a.sha256(new TextEncoder().encode(t));return new DataView(e.buffer,e.byteOffset,e.byteLength)}}exports.AccountNameGenerator=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/sha2.cjs"),h=require("lodash-es"),d=require("./colors.cjs"),l=require("./x-names.json.cjs");class m{constructor(t,e){this.nameList=t||l.default,this.colorList=e||d.nameDataColors}generate(t){const e=this.hashSeed(t),n=e.getUint32(0)%this.nameList.items.length,s=this.nameList.items[n],o=e.getUint32(4)%s.adjectives.length,i=s.adjectives[o],r=e.getUint32(8)%this.colorList.length,c=this.colorList[r];return{name:`${h.upperFirst(i)} ${s.name}`,emoji:s.emoji,color:c}}hashSeed(t){const e=a.sha256(new TextEncoder().encode(t));return new DataView(e.buffer,e.byteOffset,e.byteLength)}}exports.AccountNameGenerator=m;
@@ -1,4 +1,4 @@
1
- import { sha256 as c } from "../../node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/sha256.js";
1
+ import { sha256 as c } from "../../node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/sha2.js";
2
2
  import { upperFirst as m } from "lodash-es";
3
3
  import { nameDataColors as h } from "./colors.js";
4
4
  import d from "./x-names.json.js";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/sha3.cjs"),e=require("../../node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/utils.cjs");function i(t){return`0x${e.bytesToHex(r.keccak_256(e.utf8ToBytes(t)))}`}exports.id=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/sha3.cjs"),e=require("../../node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/utils.cjs");function i(t){return`0x${e.bytesToHex(r.keccak_256(e.utf8ToBytes(t)))}`}exports.id=i;
@@ -1,5 +1,5 @@
1
- import { keccak_256 as t } from "../../node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/sha3.js";
2
- import { bytesToHex as r, utf8ToBytes as e } from "../../node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/utils.js";
1
+ import { keccak_256 as t } from "../../node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/sha3.js";
2
+ import { bytesToHex as r, utf8ToBytes as e } from "../../node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/utils.js";
3
3
  function m(o) {
4
4
  return `0x${r(t(e(o)))}`;
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@argent/x-shared",
3
- "version": "1.75.5",
3
+ "version": "1.75.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/argentlabs/x-shared.git"
@@ -64,8 +64,8 @@
64
64
  "@types/lodash-es": "4.17.12",
65
65
  "@types/numeral": "2.0.5",
66
66
  "@types/ua-parser-js": "0.7.39",
67
- "@typescript-eslint/eslint-plugin": "8.40.0",
68
- "@typescript-eslint/parser": "8.40.0",
67
+ "@typescript-eslint/eslint-plugin": "8.41.0",
68
+ "@typescript-eslint/parser": "8.41.0",
69
69
  "esbuild": "0.25.9",
70
70
  "esbuild-register": "3.6.0",
71
71
  "eslint": "8.57.1",
@@ -89,7 +89,7 @@
89
89
  "@langchain/core": "^0.3.43",
90
90
  "@langchain/google-genai": "^0.2.2",
91
91
  "@lokalise/node-api": "^15.0.0",
92
- "@noble/hashes": "^1.3.1",
92
+ "@noble/hashes": "^2.0.0",
93
93
  "@starknet-io/types-js": "0.9.1",
94
94
  "@types/fs-extra": "^11.0.4",
95
95
  "big-decimal-number": "npm:bignumber.js@^9.1.2",
@@ -105,8 +105,8 @@
105
105
  "zod-to-json-schema": "^3.24.5"
106
106
  },
107
107
  "peerDependencies": {
108
- "@scure/base": "^1.1.1",
109
- "@scure/bip39": "^1.2.1",
108
+ "@scure/base": "^2.0.0",
109
+ "@scure/bip39": "^2.0.0",
110
110
  "async-retry": "^1.3.3",
111
111
  "lodash-es": "^4.17.21",
112
112
  "ua-parser-js": "^1.0.38 || ^2.0.0",
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function i(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function n(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function o(e,...t){if(!n(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function s(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function u(e,t){o(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}exports.bytes=o;exports.exists=s;exports.isBytes=n;exports.number=i;exports.output=u;
@@ -1,32 +0,0 @@
1
- function i(e) {
2
- if (!Number.isSafeInteger(e) || e < 0)
3
- throw new Error(`positive integer expected, not ${e}`);
4
- }
5
- function n(e) {
6
- return e instanceof Uint8Array || e != null && typeof e == "object" && e.constructor.name === "Uint8Array";
7
- }
8
- function o(e, ...t) {
9
- if (!n(e))
10
- throw new Error("Uint8Array expected");
11
- if (t.length > 0 && !t.includes(e.length))
12
- throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`);
13
- }
14
- function f(e, t = !0) {
15
- if (e.destroyed)
16
- throw new Error("Hash instance has been destroyed");
17
- if (t && e.finished)
18
- throw new Error("Hash#digest() has already been called");
19
- }
20
- function s(e, t) {
21
- o(e);
22
- const r = t.outputLen;
23
- if (e.length < r)
24
- throw new Error(`digestInto() expects output buffer of length at least ${r}`);
25
- }
26
- export {
27
- o as bytes,
28
- f as exists,
29
- n as isBytes,
30
- i as number,
31
- s as output
32
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./_assert.cjs"),u=require("./utils.cjs");function a(o,t,s,i){if(typeof o.setBigUint64=="function")return o.setBigUint64(t,s,i);const n=BigInt(32),h=BigInt(4294967295),e=Number(s>>n&h),r=Number(s&h),c=i?4:0,l=i?0:4;o.setUint32(t+c,e,i),o.setUint32(t+l,r,i)}const d=(o,t,s)=>o&t^~o&s,b=(o,t,s)=>o&t^o&s^t&s;class w extends u.Hash{constructor(t,s,i,n){super(),this.blockLen=t,this.outputLen=s,this.padOffset=i,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=u.createView(this.buffer)}update(t){p.exists(this);const{view:s,buffer:i,blockLen:n}=this;t=u.toBytes(t);const h=t.length;for(let e=0;e<h;){const r=Math.min(n-this.pos,h-e);if(r===n){const c=u.createView(t);for(;n<=h-e;e+=n)this.process(c,e);continue}i.set(t.subarray(e,e+r),this.pos),this.pos+=r,e+=r,this.pos===n&&(this.process(s,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){p.exists(this),p.output(t,this),this.finished=!0;const{buffer:s,view:i,blockLen:n,isLE:h}=this;let{pos:e}=this;s[e++]=128,this.buffer.subarray(e).fill(0),this.padOffset>n-e&&(this.process(i,0),e=0);for(let f=e;f<n;f++)s[f]=0;a(i,n-8,BigInt(this.length*8),h),this.process(i,0);const r=u.createView(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,g=this.get();if(l>g.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<l;f++)r.setUint32(4*f,g[f],h)}digest(){const{buffer:t,outputLen:s}=this;this.digestInto(t);const i=t.slice(0,s);return this.destroy(),i}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:s,buffer:i,length:n,finished:h,destroyed:e,pos:r}=this;return t.length=n,t.pos=r,t.finished=h,t.destroyed=e,n%s&&t.buffer.set(i),t}}exports.Chi=d;exports.HashMD=w;exports.Maj=b;
@@ -1,64 +0,0 @@
1
- import { exists as g, output as d } from "./_assert.js";
2
- import { Hash as b, createView as p, toBytes as a } from "./utils.js";
3
- function w(o, t, s, i) {
4
- if (typeof o.setBigUint64 == "function")
5
- return o.setBigUint64(t, s, i);
6
- const n = BigInt(32), h = BigInt(4294967295), e = Number(s >> n & h), r = Number(s & h), c = i ? 4 : 0, u = i ? 0 : 4;
7
- o.setUint32(t + c, e, i), o.setUint32(t + u, r, i);
8
- }
9
- const B = (o, t, s) => o & t ^ ~o & s, L = (o, t, s) => o & t ^ o & s ^ t & s;
10
- class U extends b {
11
- constructor(t, s, i, n) {
12
- super(), this.blockLen = t, this.outputLen = s, this.padOffset = i, this.isLE = n, this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.buffer = new Uint8Array(t), this.view = p(this.buffer);
13
- }
14
- update(t) {
15
- g(this);
16
- const { view: s, buffer: i, blockLen: n } = this;
17
- t = a(t);
18
- const h = t.length;
19
- for (let e = 0; e < h; ) {
20
- const r = Math.min(n - this.pos, h - e);
21
- if (r === n) {
22
- const c = p(t);
23
- for (; n <= h - e; e += n)
24
- this.process(c, e);
25
- continue;
26
- }
27
- i.set(t.subarray(e, e + r), this.pos), this.pos += r, e += r, this.pos === n && (this.process(s, 0), this.pos = 0);
28
- }
29
- return this.length += t.length, this.roundClean(), this;
30
- }
31
- digestInto(t) {
32
- g(this), d(t, this), this.finished = !0;
33
- const { buffer: s, view: i, blockLen: n, isLE: h } = this;
34
- let { pos: e } = this;
35
- s[e++] = 128, this.buffer.subarray(e).fill(0), this.padOffset > n - e && (this.process(i, 0), e = 0);
36
- for (let f = e; f < n; f++)
37
- s[f] = 0;
38
- w(i, n - 8, BigInt(this.length * 8), h), this.process(i, 0);
39
- const r = p(t), c = this.outputLen;
40
- if (c % 4)
41
- throw new Error("_sha2: outputLen should be aligned to 32bit");
42
- const u = c / 4, l = this.get();
43
- if (u > l.length)
44
- throw new Error("_sha2: outputLen bigger than state");
45
- for (let f = 0; f < u; f++)
46
- r.setUint32(4 * f, l[f], h);
47
- }
48
- digest() {
49
- const { buffer: t, outputLen: s } = this;
50
- this.digestInto(t);
51
- const i = t.slice(0, s);
52
- return this.destroy(), i;
53
- }
54
- _cloneInto(t) {
55
- t || (t = new this.constructor()), t.set(...this.get());
56
- const { blockLen: s, buffer: i, length: n, finished: h, destroyed: e, pos: r } = this;
57
- return t.length = n, t.pos = r, t.finished = h, t.destroyed = e, n % s && t.buffer.set(i), t;
58
- }
59
- }
60
- export {
61
- B as Chi,
62
- U as HashMD,
63
- L as Maj
64
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=BigInt(2**32-1),i=BigInt(32);function u(t,e=!1){return e?{h:Number(t&n),l:Number(t>>i&n)}:{h:Number(t>>i&n)|0,l:Number(t&n)|0}}function g(t,e=!1){let r=new Uint32Array(t.length),l=new Uint32Array(t.length);for(let o=0;o<t.length;o++){const{h:c,l:f}=u(t[o],e);[r[o],l[o]]=[c,f]}return[r,l]}const B=(t,e,r)=>t<<r|e>>>32-r,h=(t,e,r)=>e<<r|t>>>32-r,m=(t,e,r)=>e<<r-32|t>>>64-r,S=(t,e,r)=>t<<r-32|e>>>64-r;exports.fromBig=u;exports.rotlBH=m;exports.rotlBL=S;exports.rotlSH=B;exports.rotlSL=h;exports.split=g;
@@ -1,21 +0,0 @@
1
- const o = /* @__PURE__ */ BigInt(4294967295), i = /* @__PURE__ */ BigInt(32);
2
- function f(t, r = !1) {
3
- return r ? { h: Number(t & o), l: Number(t >> i & o) } : { h: Number(t >> i & o) | 0, l: Number(t & o) | 0 };
4
- }
5
- function h(t, r = !1) {
6
- let n = new Uint32Array(t.length), l = new Uint32Array(t.length);
7
- for (let e = 0; e < t.length; e++) {
8
- const { h: c, l: u } = f(t[e], r);
9
- [n[e], l[e]] = [c, u];
10
- }
11
- return [n, l];
12
- }
13
- const g = (t, r, n) => t << n | r >>> 32 - n, m = (t, r, n) => r << n | t >>> 32 - n, A = (t, r, n) => r << n - 32 | t >>> 64 - n, B = (t, r, n) => t << n - 32 | r >>> 64 - n;
14
- export {
15
- f as fromBig,
16
- A as rotlBH,
17
- B as rotlBL,
18
- g as rotlSH,
19
- m as rotlSL,
20
- h as split
21
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("./_md.cjs"),s=require("./utils.cjs"),S=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),b=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),f=new Uint32Array(64);class g extends H.HashMD{constructor(){super(64,32,8,!1),this.A=b[0]|0,this.B=b[1]|0,this.C=b[2]|0,this.D=b[3]|0,this.E=b[4]|0,this.F=b[5]|0,this.G=b[6]|0,this.H=b[7]|0}get(){const{A:d,B:o,C:x,D:e,E:a,F:i,G:c,H:r}=this;return[d,o,x,e,a,i,c,r]}set(d,o,x,e,a,i,c,r){this.A=d|0,this.B=o|0,this.C=x|0,this.D=e|0,this.E=a|0,this.F=i|0,this.G=c|0,this.H=r|0}process(d,o){for(let t=0;t<16;t++,o+=4)f[t]=d.getUint32(o,!1);for(let t=16;t<64;t++){const A=f[t-15],n=f[t-2],C=s.rotr(A,7)^s.rotr(A,18)^A>>>3,u=s.rotr(n,17)^s.rotr(n,19)^n>>>10;f[t]=u+f[t-7]+C+f[t-16]|0}let{A:x,B:e,C:a,D:i,E:c,F:r,G:h,H:l}=this;for(let t=0;t<64;t++){const A=s.rotr(c,6)^s.rotr(c,11)^s.rotr(c,25),n=l+A+H.Chi(c,r,h)+S[t]+f[t]|0,u=(s.rotr(x,2)^s.rotr(x,13)^s.rotr(x,22))+H.Maj(x,e,a)|0;l=h,h=r,r=c,c=i+n|0,i=a,a=e,e=x,x=n+u|0}x=x+this.A|0,e=e+this.B|0,a=a+this.C|0,i=i+this.D|0,c=c+this.E|0,r=r+this.F|0,h=h+this.G|0,l=l+this.H|0,this.set(x,e,a,i,c,r,h,l)}roundClean(){f.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const y=s.wrapConstructor(()=>new g);exports.SHA256=g;exports.sha256=y;
@@ -1,115 +0,0 @@
1
- import { HashMD as m, Chi as p, Maj as u } from "./_md.js";
2
- import { wrapConstructor as D, rotr as i } from "./utils.js";
3
- const g = /* @__PURE__ */ new Uint32Array([
4
- 1116352408,
5
- 1899447441,
6
- 3049323471,
7
- 3921009573,
8
- 961987163,
9
- 1508970993,
10
- 2453635748,
11
- 2870763221,
12
- 3624381080,
13
- 310598401,
14
- 607225278,
15
- 1426881987,
16
- 1925078388,
17
- 2162078206,
18
- 2614888103,
19
- 3248222580,
20
- 3835390401,
21
- 4022224774,
22
- 264347078,
23
- 604807628,
24
- 770255983,
25
- 1249150122,
26
- 1555081692,
27
- 1996064986,
28
- 2554220882,
29
- 2821834349,
30
- 2952996808,
31
- 3210313671,
32
- 3336571891,
33
- 3584528711,
34
- 113926993,
35
- 338241895,
36
- 666307205,
37
- 773529912,
38
- 1294757372,
39
- 1396182291,
40
- 1695183700,
41
- 1986661051,
42
- 2177026350,
43
- 2456956037,
44
- 2730485921,
45
- 2820302411,
46
- 3259730800,
47
- 3345764771,
48
- 3516065817,
49
- 3600352804,
50
- 4094571909,
51
- 275423344,
52
- 430227734,
53
- 506948616,
54
- 659060556,
55
- 883997877,
56
- 958139571,
57
- 1322822218,
58
- 1537002063,
59
- 1747873779,
60
- 1955562222,
61
- 2024104815,
62
- 2227730452,
63
- 2361852424,
64
- 2428436474,
65
- 2756734187,
66
- 3204031479,
67
- 3329325298
68
- ]), b = /* @__PURE__ */ new Uint32Array([
69
- 1779033703,
70
- 3144134277,
71
- 1013904242,
72
- 2773480762,
73
- 1359893119,
74
- 2600822924,
75
- 528734635,
76
- 1541459225
77
- ]), h = /* @__PURE__ */ new Uint32Array(64);
78
- class w extends m {
79
- constructor() {
80
- super(64, 32, 8, !1), this.A = b[0] | 0, this.B = b[1] | 0, this.C = b[2] | 0, this.D = b[3] | 0, this.E = b[4] | 0, this.F = b[5] | 0, this.G = b[6] | 0, this.H = b[7] | 0;
81
- }
82
- get() {
83
- const { A: d, B: o, C: t, D: s, E: a, F: f, G: c, H: e } = this;
84
- return [d, o, t, s, a, f, c, e];
85
- }
86
- // prettier-ignore
87
- set(d, o, t, s, a, f, c, e) {
88
- this.A = d | 0, this.B = o | 0, this.C = t | 0, this.D = s | 0, this.E = a | 0, this.F = f | 0, this.G = c | 0, this.H = e | 0;
89
- }
90
- process(d, o) {
91
- for (let x = 0; x < 16; x++, o += 4)
92
- h[x] = d.getUint32(o, !1);
93
- for (let x = 16; x < 64; x++) {
94
- const A = h[x - 15], n = h[x - 2], C = i(A, 7) ^ i(A, 18) ^ A >>> 3, H = i(n, 17) ^ i(n, 19) ^ n >>> 10;
95
- h[x] = H + h[x - 7] + C + h[x - 16] | 0;
96
- }
97
- let { A: t, B: s, C: a, D: f, E: c, F: e, G: r, H: l } = this;
98
- for (let x = 0; x < 64; x++) {
99
- const A = i(c, 6) ^ i(c, 11) ^ i(c, 25), n = l + A + p(c, e, r) + g[x] + h[x] | 0, H = (i(t, 2) ^ i(t, 13) ^ i(t, 22)) + u(t, s, a) | 0;
100
- l = r, r = e, e = c, c = f + n | 0, f = a, a = s, s = t, t = n + H | 0;
101
- }
102
- t = t + this.A | 0, s = s + this.B | 0, a = a + this.C | 0, f = f + this.D | 0, c = c + this.E | 0, e = e + this.F | 0, r = r + this.G | 0, l = l + this.H | 0, this.set(t, s, a, f, c, e, r, l);
103
- }
104
- roundClean() {
105
- h.fill(0);
106
- }
107
- destroy() {
108
- this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
109
- }
110
- }
111
- const G = /* @__PURE__ */ D(() => new w());
112
- export {
113
- w as SHA256,
114
- G as sha256
115
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./_assert.cjs"),a=require("./_u64.cjs"),c=require("./utils.cjs"),I=[],O=[],w=[],B=BigInt(0),f=BigInt(1),A=BigInt(2),S=BigInt(7),H=BigInt(256),T=BigInt(113);for(let i=0,t=f,s=1,n=0;i<24;i++){[s,n]=[n,(2*s+3*n)%5],I.push(2*(5*n+s)),O.push((i+1)*(i+2)/2%64);let o=B;for(let r=0;r<7;r++)t=(t<<f^(t>>S)*T)%H,t&A&&(o^=f<<(f<<BigInt(r))-f);w.push(o)}const[m,E]=a.split(w,!0),y=(i,t,s)=>s>32?a.rotlBH(i,t,s):a.rotlSH(i,t,s),b=(i,t,s)=>s>32?a.rotlBL(i,t,s):a.rotlSL(i,t,s);function L(i,t=24){const s=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let e=0;e<10;e++)s[e]=i[e]^i[e+10]^i[e+20]^i[e+30]^i[e+40];for(let e=0;e<10;e+=2){const h=(e+8)%10,p=(e+2)%10,d=s[p],u=s[p+1],_=y(d,u,1)^s[h],g=b(d,u,1)^s[h+1];for(let k=0;k<50;k+=10)i[e+k]^=_,i[e+k+1]^=g}let o=i[2],r=i[3];for(let e=0;e<24;e++){const h=O[e],p=y(o,r,h),d=b(o,r,h),u=I[e];o=i[u],r=i[u+1],i[u]=p,i[u+1]=d}for(let e=0;e<50;e+=10){for(let h=0;h<10;h++)s[h]=i[e+h];for(let h=0;h<10;h++)i[e+h]^=~s[(h+2)%10]&s[(h+4)%10]}i[0]^=m[n],i[1]^=E[n]}s.fill(0)}class x extends c.Hash{constructor(t,s,n,o=!1,r=24){if(super(),this.blockLen=t,this.suffix=s,this.outputLen=n,this.enableXOF=o,this.rounds=r,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,l.number(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=c.u32(this.state)}keccak(){c.isLE||c.byteSwap32(this.state32),L(this.state32,this.rounds),c.isLE||c.byteSwap32(this.state32),this.posOut=0,this.pos=0}update(t){l.exists(this);const{blockLen:s,state:n}=this;t=c.toBytes(t);const o=t.length;for(let r=0;r<o;){const e=Math.min(s-this.pos,o-r);for(let h=0;h<e;h++)n[this.pos++]^=t[r++];this.pos===s&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:s,pos:n,blockLen:o}=this;t[n]^=s,(s&128)!==0&&n===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){l.exists(this,!1),l.bytes(t),this.finish();const s=this.state,{blockLen:n}=this;for(let o=0,r=t.length;o<r;){this.posOut>=n&&this.keccak();const e=Math.min(n-this.posOut,r-o);t.set(s.subarray(this.posOut,this.posOut+e),o),this.posOut+=e,o+=e}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return l.number(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(l.output(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:s,suffix:n,outputLen:o,rounds:r,enableXOF:e}=this;return t||(t=new x(s,n,o,e,r)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=r,t.suffix=n,t.outputLen=o,t.enableXOF=e,t.destroyed=this.destroyed,t}}const F=(i,t,s)=>c.wrapConstructor(()=>new x(t,i,s)),P=F(1,136,256/8);exports.Keccak=x;exports.keccakP=L;exports.keccak_256=P;
@@ -1,107 +0,0 @@
1
- import { number as d, exists as k, bytes as B, output as A } from "./_assert.js";
2
- import { rotlSH as H, rotlSL as m, rotlBH as S, rotlBL as T, split as F } from "./_u64.js";
3
- import { wrapConstructor as X, Hash as E, u32 as U, isLE as x, byteSwap32 as I, toBytes as P } from "./utils.js";
4
- const y = [], L = [], b = [], M = /* @__PURE__ */ BigInt(0), f = /* @__PURE__ */ BigInt(1), R = /* @__PURE__ */ BigInt(2), j = /* @__PURE__ */ BigInt(7), C = /* @__PURE__ */ BigInt(256), q = /* @__PURE__ */ BigInt(113);
5
- for (let e = 0, t = f, s = 1, n = 0; e < 24; e++) {
6
- [s, n] = [n, (2 * s + 3 * n) % 5], y.push(2 * (5 * n + s)), L.push((e + 1) * (e + 2) / 2 % 64);
7
- let o = M;
8
- for (let r = 0; r < 7; r++)
9
- t = (t << f ^ (t >> j) * q) % C, t & R && (o ^= f << (f << /* @__PURE__ */ BigInt(r)) - f);
10
- b.push(o);
11
- }
12
- const [v, z] = /* @__PURE__ */ F(b, !0), O = (e, t, s) => s > 32 ? S(e, t, s) : H(e, t, s), w = (e, t, s) => s > 32 ? T(e, t, s) : m(e, t, s);
13
- function D(e, t = 24) {
14
- const s = new Uint32Array(10);
15
- for (let n = 24 - t; n < 24; n++) {
16
- for (let i = 0; i < 10; i++)
17
- s[i] = e[i] ^ e[i + 10] ^ e[i + 20] ^ e[i + 30] ^ e[i + 40];
18
- for (let i = 0; i < 10; i += 2) {
19
- const h = (i + 8) % 10, l = (i + 2) % 10, u = s[l], c = s[l + 1], _ = O(u, c, 1) ^ s[h], g = w(u, c, 1) ^ s[h + 1];
20
- for (let a = 0; a < 50; a += 10)
21
- e[i + a] ^= _, e[i + a + 1] ^= g;
22
- }
23
- let o = e[2], r = e[3];
24
- for (let i = 0; i < 24; i++) {
25
- const h = L[i], l = O(o, r, h), u = w(o, r, h), c = y[i];
26
- o = e[c], r = e[c + 1], e[c] = l, e[c + 1] = u;
27
- }
28
- for (let i = 0; i < 50; i += 10) {
29
- for (let h = 0; h < 10; h++)
30
- s[h] = e[i + h];
31
- for (let h = 0; h < 10; h++)
32
- e[i + h] ^= ~s[(h + 2) % 10] & s[(h + 4) % 10];
33
- }
34
- e[0] ^= v[n], e[1] ^= z[n];
35
- }
36
- s.fill(0);
37
- }
38
- class p extends E {
39
- // NOTE: we accept arguments in bytes instead of bits here.
40
- constructor(t, s, n, o = !1, r = 24) {
41
- if (super(), this.blockLen = t, this.suffix = s, this.outputLen = n, this.enableXOF = o, this.rounds = r, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, d(n), 0 >= this.blockLen || this.blockLen >= 200)
42
- throw new Error("Sha3 supports only keccak-f1600 function");
43
- this.state = new Uint8Array(200), this.state32 = U(this.state);
44
- }
45
- keccak() {
46
- x || I(this.state32), D(this.state32, this.rounds), x || I(this.state32), this.posOut = 0, this.pos = 0;
47
- }
48
- update(t) {
49
- k(this);
50
- const { blockLen: s, state: n } = this;
51
- t = P(t);
52
- const o = t.length;
53
- for (let r = 0; r < o; ) {
54
- const i = Math.min(s - this.pos, o - r);
55
- for (let h = 0; h < i; h++)
56
- n[this.pos++] ^= t[r++];
57
- this.pos === s && this.keccak();
58
- }
59
- return this;
60
- }
61
- finish() {
62
- if (this.finished)
63
- return;
64
- this.finished = !0;
65
- const { state: t, suffix: s, pos: n, blockLen: o } = this;
66
- t[n] ^= s, (s & 128) !== 0 && n === o - 1 && this.keccak(), t[o - 1] ^= 128, this.keccak();
67
- }
68
- writeInto(t) {
69
- k(this, !1), B(t), this.finish();
70
- const s = this.state, { blockLen: n } = this;
71
- for (let o = 0, r = t.length; o < r; ) {
72
- this.posOut >= n && this.keccak();
73
- const i = Math.min(n - this.posOut, r - o);
74
- t.set(s.subarray(this.posOut, this.posOut + i), o), this.posOut += i, o += i;
75
- }
76
- return t;
77
- }
78
- xofInto(t) {
79
- if (!this.enableXOF)
80
- throw new Error("XOF is not possible for this instance");
81
- return this.writeInto(t);
82
- }
83
- xof(t) {
84
- return d(t), this.xofInto(new Uint8Array(t));
85
- }
86
- digestInto(t) {
87
- if (A(t, this), this.finished)
88
- throw new Error("digest() was already called");
89
- return this.writeInto(t), this.destroy(), t;
90
- }
91
- digest() {
92
- return this.digestInto(new Uint8Array(this.outputLen));
93
- }
94
- destroy() {
95
- this.destroyed = !0, this.state.fill(0);
96
- }
97
- _cloneInto(t) {
98
- const { blockLen: s, suffix: n, outputLen: o, rounds: r, enableXOF: i } = this;
99
- return t || (t = new p(s, n, o, i, r)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = r, t.suffix = n, t.outputLen = o, t.enableXOF = i, t.destroyed = this.destroyed, t;
100
- }
101
- }
102
- const G = (e, t, s) => X(() => new p(t, e, s)), Q = /* @__PURE__ */ G(1, 136, 256 / 8);
103
- export {
104
- p as Keccak,
105
- D as keccakP,
106
- Q as keccak_256
107
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./_assert.cjs");/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const u=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),i=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),y=(t,e)=>t<<32-e|t>>>e,b=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,r=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function p(t){for(let e=0;e<t.length;e++)t[e]=r(t[e])}const l=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function g(t){o.bytes(t);let e="";for(let n=0;n<t.length;n++)e+=l[t[n]];return e}function f(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function s(t){return typeof t=="string"&&(t=f(t)),o.bytes(t),t}class w{clone(){return this._cloneInto()}}function x(t){const e=c=>t().update(s(c)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}exports.Hash=w;exports.byteSwap=r;exports.byteSwap32=p;exports.bytesToHex=g;exports.createView=i;exports.isLE=b;exports.rotr=y;exports.toBytes=s;exports.u32=u;exports.utf8ToBytes=f;exports.wrapConstructor=x;
@@ -1,46 +0,0 @@
1
- import { bytes as o } from "./_assert.js";
2
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3
- const y = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)), p = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength), l = (t, e) => t << 32 - e | t >>> e, x = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68, r = (t) => t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255;
4
- function b(t) {
5
- for (let e = 0; e < t.length; e++)
6
- t[e] = r(t[e]);
7
- }
8
- const c = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
9
- function g(t) {
10
- o(t);
11
- let e = "";
12
- for (let n = 0; n < t.length; n++)
13
- e += c[t[n]];
14
- return e;
15
- }
16
- function i(t) {
17
- if (typeof t != "string")
18
- throw new Error(`utf8ToBytes expected string, got ${typeof t}`);
19
- return new Uint8Array(new TextEncoder().encode(t));
20
- }
21
- function u(t) {
22
- return typeof t == "string" && (t = i(t)), o(t), t;
23
- }
24
- class w {
25
- // Safe version that clones internal state
26
- clone() {
27
- return this._cloneInto();
28
- }
29
- }
30
- function h(t) {
31
- const e = (f) => t().update(u(f)).digest(), n = t();
32
- return e.outputLen = n.outputLen, e.blockLen = n.blockLen, e.create = () => t(), e;
33
- }
34
- export {
35
- w as Hash,
36
- r as byteSwap,
37
- b as byteSwap32,
38
- g as bytesToHex,
39
- p as createView,
40
- x as isLE,
41
- l as rotr,
42
- u as toBytes,
43
- y as u32,
44
- i as utf8ToBytes,
45
- h as wrapConstructor
46
- };