@waku/rln 0.1.5-cad3e7a.0 → 0.1.5-d0da8f8.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.
Files changed (179) hide show
  1. package/bundle/_virtual/utils.js +2 -2
  2. package/bundle/_virtual/utils2.js +2 -2
  3. package/bundle/index.js +4 -3
  4. package/bundle/packages/rln/dist/contract/constants.js +2 -1
  5. package/bundle/packages/rln/dist/contract/{rln_light_contract.js → rln_base_contract.js} +189 -186
  6. package/bundle/packages/rln/dist/contract/rln_contract.js +10 -420
  7. package/bundle/packages/rln/dist/contract/types.js +9 -0
  8. package/bundle/packages/rln/dist/create.js +1 -1
  9. package/bundle/packages/rln/dist/{rln_light.js → credentials_manager.js} +114 -48
  10. package/bundle/packages/rln/dist/identity.js +0 -9
  11. package/bundle/packages/rln/dist/keystore/keystore.js +31 -17
  12. package/bundle/packages/rln/dist/rln.js +57 -167
  13. package/bundle/packages/rln/dist/utils/bytes.js +8 -2
  14. package/bundle/packages/rln/dist/utils/metamask.js +2 -2
  15. package/bundle/packages/rln/dist/zerokit.js +5 -5
  16. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/random.js +1 -1
  17. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/utils.js +2 -2
  18. package/bundle/packages/rln/node_modules/@noble/hashes/_sha2.js +1 -1
  19. package/bundle/packages/rln/node_modules/@noble/hashes/hmac.js +1 -1
  20. package/bundle/packages/rln/node_modules/@noble/hashes/pbkdf2.js +1 -1
  21. package/bundle/packages/rln/node_modules/@noble/hashes/scrypt.js +1 -1
  22. package/bundle/packages/rln/node_modules/@noble/hashes/sha256.js +1 -1
  23. package/bundle/packages/rln/node_modules/@noble/hashes/sha512.js +1 -1
  24. package/bundle/packages/rln/node_modules/@noble/hashes/utils.js +1 -1
  25. package/dist/.tsbuildinfo +1 -1
  26. package/dist/contract/constants.d.ts +1 -1
  27. package/dist/contract/constants.js +1 -1
  28. package/dist/contract/constants.js.map +1 -1
  29. package/dist/contract/index.d.ts +1 -0
  30. package/dist/contract/index.js +1 -0
  31. package/dist/contract/index.js.map +1 -1
  32. package/dist/contract/{rln_light_contract.d.ts → rln_base_contract.d.ts} +24 -58
  33. package/dist/contract/{rln_light_contract.js → rln_base_contract.js} +187 -184
  34. package/dist/contract/rln_base_contract.js.map +1 -0
  35. package/dist/contract/rln_contract.d.ts +5 -122
  36. package/dist/contract/rln_contract.js +8 -417
  37. package/dist/contract/rln_contract.js.map +1 -1
  38. package/dist/contract/types.d.ts +45 -0
  39. package/dist/contract/types.js +8 -0
  40. package/dist/contract/types.js.map +1 -0
  41. package/dist/create.js +1 -1
  42. package/dist/create.js.map +1 -1
  43. package/dist/credentials_manager.d.ts +44 -0
  44. package/dist/credentials_manager.js +197 -0
  45. package/dist/credentials_manager.js.map +1 -0
  46. package/dist/identity.d.ts +0 -1
  47. package/dist/identity.js +0 -9
  48. package/dist/identity.js.map +1 -1
  49. package/dist/index.d.ts +5 -4
  50. package/dist/index.js +4 -3
  51. package/dist/index.js.map +1 -1
  52. package/dist/keystore/keystore.d.ts +1 -0
  53. package/dist/keystore/keystore.js +31 -17
  54. package/dist/keystore/keystore.js.map +1 -1
  55. package/dist/keystore/types.d.ts +3 -3
  56. package/dist/rln.d.ts +9 -52
  57. package/dist/rln.js +55 -164
  58. package/dist/rln.js.map +1 -1
  59. package/dist/types.d.ts +27 -0
  60. package/dist/types.js +2 -0
  61. package/dist/types.js.map +1 -0
  62. package/dist/utils/bytes.js +8 -2
  63. package/dist/utils/bytes.js.map +1 -1
  64. package/dist/zerokit.d.ts +3 -3
  65. package/dist/zerokit.js +5 -5
  66. package/dist/zerokit.js.map +1 -1
  67. package/package.json +1 -1
  68. package/src/contract/constants.ts +1 -1
  69. package/src/contract/index.ts +1 -0
  70. package/src/contract/{rln_light_contract.ts → rln_base_contract.ts} +306 -323
  71. package/src/contract/rln_contract.ts +9 -663
  72. package/src/contract/types.ts +53 -0
  73. package/src/create.ts +1 -1
  74. package/src/credentials_manager.ts +282 -0
  75. package/src/identity.ts +0 -10
  76. package/src/index.ts +7 -5
  77. package/src/keystore/keystore.ts +57 -31
  78. package/src/keystore/types.ts +3 -3
  79. package/src/rln.ts +68 -259
  80. package/src/types.ts +31 -0
  81. package/src/utils/bytes.ts +10 -2
  82. package/src/zerokit.ts +3 -3
  83. package/bundle/_virtual/__node-resolve_empty.js +0 -6
  84. package/bundle/_virtual/_node-resolve_empty.js +0 -3
  85. package/bundle/_virtual/bn.js +0 -3
  86. package/bundle/_virtual/common.js +0 -3
  87. package/bundle/_virtual/common2.js +0 -3
  88. package/bundle/_virtual/hash.js +0 -3
  89. package/bundle/_virtual/inherits_browser.js +0 -3
  90. package/bundle/_virtual/ripemd.js +0 -3
  91. package/bundle/_virtual/sha.js +0 -3
  92. package/bundle/_virtual/sha3.js +0 -3
  93. package/bundle/_virtual/utils3.js +0 -3
  94. package/bundle/node_modules/@ethersproject/abi/lib.esm/_version.js +0 -3
  95. package/bundle/node_modules/@ethersproject/abi/lib.esm/abi-coder.js +0 -96
  96. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js +0 -148
  97. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/address.js +0 -26
  98. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/anonymous.js +0 -20
  99. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/array.js +0 -210
  100. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/boolean.js +0 -18
  101. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/bytes.js +0 -30
  102. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/fixed-bytes.js +0 -26
  103. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/null.js +0 -22
  104. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/number.js +0 -43
  105. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/string.js +0 -19
  106. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/tuple.js +0 -58
  107. package/bundle/node_modules/@ethersproject/abi/lib.esm/fragments.js +0 -854
  108. package/bundle/node_modules/@ethersproject/abi/lib.esm/interface.js +0 -609
  109. package/bundle/node_modules/@ethersproject/abstract-provider/lib.esm/_version.js +0 -3
  110. package/bundle/node_modules/@ethersproject/abstract-provider/lib.esm/index.js +0 -66
  111. package/bundle/node_modules/@ethersproject/abstract-signer/lib.esm/_version.js +0 -3
  112. package/bundle/node_modules/@ethersproject/abstract-signer/lib.esm/index.js +0 -302
  113. package/bundle/node_modules/@ethersproject/address/lib.esm/_version.js +0 -3
  114. package/bundle/node_modules/@ethersproject/address/lib.esm/index.js +0 -110
  115. package/bundle/node_modules/@ethersproject/base64/lib.esm/base64.js +0 -20
  116. package/bundle/node_modules/@ethersproject/basex/lib.esm/index.js +0 -120
  117. package/bundle/node_modules/@ethersproject/bignumber/lib.esm/_version.js +0 -3
  118. package/bundle/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js +0 -287
  119. package/bundle/node_modules/@ethersproject/bytes/lib.esm/_version.js +0 -3
  120. package/bundle/node_modules/@ethersproject/bytes/lib.esm/index.js +0 -402
  121. package/bundle/node_modules/@ethersproject/constants/lib.esm/addresses.js +0 -3
  122. package/bundle/node_modules/@ethersproject/constants/lib.esm/bignumbers.js +0 -8
  123. package/bundle/node_modules/@ethersproject/constants/lib.esm/hashes.js +0 -3
  124. package/bundle/node_modules/@ethersproject/contracts/lib.esm/_version.js +0 -3
  125. package/bundle/node_modules/@ethersproject/contracts/lib.esm/index.js +0 -893
  126. package/bundle/node_modules/@ethersproject/hash/lib.esm/_version.js +0 -3
  127. package/bundle/node_modules/@ethersproject/hash/lib.esm/ens-normalize/decoder.js +0 -256
  128. package/bundle/node_modules/@ethersproject/hash/lib.esm/ens-normalize/include.js +0 -36
  129. package/bundle/node_modules/@ethersproject/hash/lib.esm/ens-normalize/lib.js +0 -135
  130. package/bundle/node_modules/@ethersproject/hash/lib.esm/id.js +0 -8
  131. package/bundle/node_modules/@ethersproject/hash/lib.esm/namehash.js +0 -64
  132. package/bundle/node_modules/@ethersproject/hash/lib.esm/typed-data.js +0 -443
  133. package/bundle/node_modules/@ethersproject/keccak256/lib.esm/index.js +0 -8
  134. package/bundle/node_modules/@ethersproject/keccak256/node_modules/js-sha3/src/sha3.js +0 -660
  135. package/bundle/node_modules/@ethersproject/logger/lib.esm/_version.js +0 -3
  136. package/bundle/node_modules/@ethersproject/logger/lib.esm/index.js +0 -352
  137. package/bundle/node_modules/@ethersproject/networks/lib.esm/_version.js +0 -3
  138. package/bundle/node_modules/@ethersproject/networks/lib.esm/index.js +0 -248
  139. package/bundle/node_modules/@ethersproject/properties/lib.esm/_version.js +0 -3
  140. package/bundle/node_modules/@ethersproject/properties/lib.esm/index.js +0 -127
  141. package/bundle/node_modules/@ethersproject/providers/lib.esm/_version.js +0 -3
  142. package/bundle/node_modules/@ethersproject/providers/lib.esm/base-provider.js +0 -2007
  143. package/bundle/node_modules/@ethersproject/providers/lib.esm/formatter.js +0 -422
  144. package/bundle/node_modules/@ethersproject/providers/lib.esm/json-rpc-provider.js +0 -674
  145. package/bundle/node_modules/@ethersproject/providers/lib.esm/web3-provider.js +0 -132
  146. package/bundle/node_modules/@ethersproject/rlp/lib.esm/_version.js +0 -3
  147. package/bundle/node_modules/@ethersproject/rlp/lib.esm/index.js +0 -120
  148. package/bundle/node_modules/@ethersproject/sha2/lib.esm/sha2.js +0 -8
  149. package/bundle/node_modules/@ethersproject/signing-key/lib.esm/_version.js +0 -3
  150. package/bundle/node_modules/@ethersproject/signing-key/lib.esm/elliptic.js +0 -2430
  151. package/bundle/node_modules/@ethersproject/signing-key/lib.esm/index.js +0 -76
  152. package/bundle/node_modules/@ethersproject/strings/lib.esm/_version.js +0 -3
  153. package/bundle/node_modules/@ethersproject/strings/lib.esm/utf8.js +0 -219
  154. package/bundle/node_modules/@ethersproject/transactions/lib.esm/_version.js +0 -3
  155. package/bundle/node_modules/@ethersproject/transactions/lib.esm/index.js +0 -279
  156. package/bundle/node_modules/@ethersproject/web/lib.esm/_version.js +0 -3
  157. package/bundle/node_modules/@ethersproject/web/lib.esm/geturl.js +0 -69
  158. package/bundle/node_modules/@ethersproject/web/lib.esm/index.js +0 -404
  159. package/bundle/node_modules/bech32/index.js +0 -187
  160. package/bundle/node_modules/bn.js/lib/bn.js +0 -3361
  161. package/bundle/node_modules/hash.js/lib/hash/common.js +0 -97
  162. package/bundle/node_modules/hash.js/lib/hash/hmac.js +0 -51
  163. package/bundle/node_modules/hash.js/lib/hash/ripemd.js +0 -152
  164. package/bundle/node_modules/hash.js/lib/hash/sha/1.js +0 -81
  165. package/bundle/node_modules/hash.js/lib/hash/sha/224.js +0 -33
  166. package/bundle/node_modules/hash.js/lib/hash/sha/256.js +0 -113
  167. package/bundle/node_modules/hash.js/lib/hash/sha/384.js +0 -39
  168. package/bundle/node_modules/hash.js/lib/hash/sha/512.js +0 -336
  169. package/bundle/node_modules/hash.js/lib/hash/sha/common.js +0 -53
  170. package/bundle/node_modules/hash.js/lib/hash/sha.js +0 -14
  171. package/bundle/node_modules/hash.js/lib/hash/utils.js +0 -282
  172. package/bundle/node_modules/hash.js/lib/hash.js +0 -33
  173. package/bundle/node_modules/inherits/inherits_browser.js +0 -33
  174. package/bundle/node_modules/minimalistic-assert/index.js +0 -13
  175. package/dist/contract/rln_light_contract.js.map +0 -1
  176. package/dist/rln_light.d.ts +0 -64
  177. package/dist/rln_light.js +0 -144
  178. package/dist/rln_light.js.map +0 -1
  179. package/src/rln_light.ts +0 -235
@@ -1,336 +0,0 @@
1
- import '../utils.js';
2
- import '../common.js';
3
- import { m as minimalisticAssert } from '../../../../minimalistic-assert/index.js';
4
- import { __exports as utils$1 } from '../../../../../_virtual/utils3.js';
5
- import { __exports as common$1 } from '../../../../../_virtual/common.js';
6
-
7
- var utils = utils$1;
8
- var common = common$1;
9
- var assert = minimalisticAssert;
10
-
11
- var rotr64_hi = utils.rotr64_hi;
12
- var rotr64_lo = utils.rotr64_lo;
13
- var shr64_hi = utils.shr64_hi;
14
- var shr64_lo = utils.shr64_lo;
15
- var sum64 = utils.sum64;
16
- var sum64_hi = utils.sum64_hi;
17
- var sum64_lo = utils.sum64_lo;
18
- var sum64_4_hi = utils.sum64_4_hi;
19
- var sum64_4_lo = utils.sum64_4_lo;
20
- var sum64_5_hi = utils.sum64_5_hi;
21
- var sum64_5_lo = utils.sum64_5_lo;
22
-
23
- var BlockHash = common.BlockHash;
24
-
25
- var sha512_K = [
26
- 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
27
- 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
28
- 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
29
- 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
30
- 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
31
- 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
32
- 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
33
- 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
34
- 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
35
- 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
36
- 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
37
- 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
38
- 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
39
- 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
40
- 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
41
- 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
42
- 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
43
- 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
44
- 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
45
- 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
46
- 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
47
- 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
48
- 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
49
- 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
50
- 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
51
- 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
52
- 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
53
- 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
54
- 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
55
- 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
56
- 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
57
- 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
58
- 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
59
- 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
60
- 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
61
- 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
62
- 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
63
- 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
64
- 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
65
- 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
66
- ];
67
-
68
- function SHA512() {
69
- if (!(this instanceof SHA512))
70
- return new SHA512();
71
-
72
- BlockHash.call(this);
73
- this.h = [
74
- 0x6a09e667, 0xf3bcc908,
75
- 0xbb67ae85, 0x84caa73b,
76
- 0x3c6ef372, 0xfe94f82b,
77
- 0xa54ff53a, 0x5f1d36f1,
78
- 0x510e527f, 0xade682d1,
79
- 0x9b05688c, 0x2b3e6c1f,
80
- 0x1f83d9ab, 0xfb41bd6b,
81
- 0x5be0cd19, 0x137e2179 ];
82
- this.k = sha512_K;
83
- this.W = new Array(160);
84
- }
85
- utils.inherits(SHA512, BlockHash);
86
- var _512 = SHA512;
87
-
88
- SHA512.blockSize = 1024;
89
- SHA512.outSize = 512;
90
- SHA512.hmacStrength = 192;
91
- SHA512.padLength = 128;
92
-
93
- SHA512.prototype._prepareBlock = function _prepareBlock(msg, start) {
94
- var W = this.W;
95
-
96
- // 32 x 32bit words
97
- for (var i = 0; i < 32; i++)
98
- W[i] = msg[start + i];
99
- for (; i < W.length; i += 2) {
100
- var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2
101
- var c0_lo = g1_512_lo(W[i - 4], W[i - 3]);
102
- var c1_hi = W[i - 14]; // i - 7
103
- var c1_lo = W[i - 13];
104
- var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15
105
- var c2_lo = g0_512_lo(W[i - 30], W[i - 29]);
106
- var c3_hi = W[i - 32]; // i - 16
107
- var c3_lo = W[i - 31];
108
-
109
- W[i] = sum64_4_hi(
110
- c0_hi, c0_lo,
111
- c1_hi, c1_lo,
112
- c2_hi, c2_lo,
113
- c3_hi, c3_lo);
114
- W[i + 1] = sum64_4_lo(
115
- c0_hi, c0_lo,
116
- c1_hi, c1_lo,
117
- c2_hi, c2_lo,
118
- c3_hi, c3_lo);
119
- }
120
- };
121
-
122
- SHA512.prototype._update = function _update(msg, start) {
123
- this._prepareBlock(msg, start);
124
-
125
- var W = this.W;
126
-
127
- var ah = this.h[0];
128
- var al = this.h[1];
129
- var bh = this.h[2];
130
- var bl = this.h[3];
131
- var ch = this.h[4];
132
- var cl = this.h[5];
133
- var dh = this.h[6];
134
- var dl = this.h[7];
135
- var eh = this.h[8];
136
- var el = this.h[9];
137
- var fh = this.h[10];
138
- var fl = this.h[11];
139
- var gh = this.h[12];
140
- var gl = this.h[13];
141
- var hh = this.h[14];
142
- var hl = this.h[15];
143
-
144
- assert(this.k.length === W.length);
145
- for (var i = 0; i < W.length; i += 2) {
146
- var c0_hi = hh;
147
- var c0_lo = hl;
148
- var c1_hi = s1_512_hi(eh, el);
149
- var c1_lo = s1_512_lo(eh, el);
150
- var c2_hi = ch64_hi(eh, el, fh, fl, gh);
151
- var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl);
152
- var c3_hi = this.k[i];
153
- var c3_lo = this.k[i + 1];
154
- var c4_hi = W[i];
155
- var c4_lo = W[i + 1];
156
-
157
- var T1_hi = sum64_5_hi(
158
- c0_hi, c0_lo,
159
- c1_hi, c1_lo,
160
- c2_hi, c2_lo,
161
- c3_hi, c3_lo,
162
- c4_hi, c4_lo);
163
- var T1_lo = sum64_5_lo(
164
- c0_hi, c0_lo,
165
- c1_hi, c1_lo,
166
- c2_hi, c2_lo,
167
- c3_hi, c3_lo,
168
- c4_hi, c4_lo);
169
-
170
- c0_hi = s0_512_hi(ah, al);
171
- c0_lo = s0_512_lo(ah, al);
172
- c1_hi = maj64_hi(ah, al, bh, bl, ch);
173
- c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);
174
-
175
- var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo);
176
- var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);
177
-
178
- hh = gh;
179
- hl = gl;
180
-
181
- gh = fh;
182
- gl = fl;
183
-
184
- fh = eh;
185
- fl = el;
186
-
187
- eh = sum64_hi(dh, dl, T1_hi, T1_lo);
188
- el = sum64_lo(dl, dl, T1_hi, T1_lo);
189
-
190
- dh = ch;
191
- dl = cl;
192
-
193
- ch = bh;
194
- cl = bl;
195
-
196
- bh = ah;
197
- bl = al;
198
-
199
- ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo);
200
- al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);
201
- }
202
-
203
- sum64(this.h, 0, ah, al);
204
- sum64(this.h, 2, bh, bl);
205
- sum64(this.h, 4, ch, cl);
206
- sum64(this.h, 6, dh, dl);
207
- sum64(this.h, 8, eh, el);
208
- sum64(this.h, 10, fh, fl);
209
- sum64(this.h, 12, gh, gl);
210
- sum64(this.h, 14, hh, hl);
211
- };
212
-
213
- SHA512.prototype._digest = function digest(enc) {
214
- if (enc === 'hex')
215
- return utils.toHex32(this.h, 'big');
216
- else
217
- return utils.split32(this.h, 'big');
218
- };
219
-
220
- function ch64_hi(xh, xl, yh, yl, zh) {
221
- var r = (xh & yh) ^ ((~xh) & zh);
222
- if (r < 0)
223
- r += 0x100000000;
224
- return r;
225
- }
226
-
227
- function ch64_lo(xh, xl, yh, yl, zh, zl) {
228
- var r = (xl & yl) ^ ((~xl) & zl);
229
- if (r < 0)
230
- r += 0x100000000;
231
- return r;
232
- }
233
-
234
- function maj64_hi(xh, xl, yh, yl, zh) {
235
- var r = (xh & yh) ^ (xh & zh) ^ (yh & zh);
236
- if (r < 0)
237
- r += 0x100000000;
238
- return r;
239
- }
240
-
241
- function maj64_lo(xh, xl, yh, yl, zh, zl) {
242
- var r = (xl & yl) ^ (xl & zl) ^ (yl & zl);
243
- if (r < 0)
244
- r += 0x100000000;
245
- return r;
246
- }
247
-
248
- function s0_512_hi(xh, xl) {
249
- var c0_hi = rotr64_hi(xh, xl, 28);
250
- var c1_hi = rotr64_hi(xl, xh, 2); // 34
251
- var c2_hi = rotr64_hi(xl, xh, 7); // 39
252
-
253
- var r = c0_hi ^ c1_hi ^ c2_hi;
254
- if (r < 0)
255
- r += 0x100000000;
256
- return r;
257
- }
258
-
259
- function s0_512_lo(xh, xl) {
260
- var c0_lo = rotr64_lo(xh, xl, 28);
261
- var c1_lo = rotr64_lo(xl, xh, 2); // 34
262
- var c2_lo = rotr64_lo(xl, xh, 7); // 39
263
-
264
- var r = c0_lo ^ c1_lo ^ c2_lo;
265
- if (r < 0)
266
- r += 0x100000000;
267
- return r;
268
- }
269
-
270
- function s1_512_hi(xh, xl) {
271
- var c0_hi = rotr64_hi(xh, xl, 14);
272
- var c1_hi = rotr64_hi(xh, xl, 18);
273
- var c2_hi = rotr64_hi(xl, xh, 9); // 41
274
-
275
- var r = c0_hi ^ c1_hi ^ c2_hi;
276
- if (r < 0)
277
- r += 0x100000000;
278
- return r;
279
- }
280
-
281
- function s1_512_lo(xh, xl) {
282
- var c0_lo = rotr64_lo(xh, xl, 14);
283
- var c1_lo = rotr64_lo(xh, xl, 18);
284
- var c2_lo = rotr64_lo(xl, xh, 9); // 41
285
-
286
- var r = c0_lo ^ c1_lo ^ c2_lo;
287
- if (r < 0)
288
- r += 0x100000000;
289
- return r;
290
- }
291
-
292
- function g0_512_hi(xh, xl) {
293
- var c0_hi = rotr64_hi(xh, xl, 1);
294
- var c1_hi = rotr64_hi(xh, xl, 8);
295
- var c2_hi = shr64_hi(xh, xl, 7);
296
-
297
- var r = c0_hi ^ c1_hi ^ c2_hi;
298
- if (r < 0)
299
- r += 0x100000000;
300
- return r;
301
- }
302
-
303
- function g0_512_lo(xh, xl) {
304
- var c0_lo = rotr64_lo(xh, xl, 1);
305
- var c1_lo = rotr64_lo(xh, xl, 8);
306
- var c2_lo = shr64_lo(xh, xl, 7);
307
-
308
- var r = c0_lo ^ c1_lo ^ c2_lo;
309
- if (r < 0)
310
- r += 0x100000000;
311
- return r;
312
- }
313
-
314
- function g1_512_hi(xh, xl) {
315
- var c0_hi = rotr64_hi(xh, xl, 19);
316
- var c1_hi = rotr64_hi(xl, xh, 29); // 61
317
- var c2_hi = shr64_hi(xh, xl, 6);
318
-
319
- var r = c0_hi ^ c1_hi ^ c2_hi;
320
- if (r < 0)
321
- r += 0x100000000;
322
- return r;
323
- }
324
-
325
- function g1_512_lo(xh, xl) {
326
- var c0_lo = rotr64_lo(xh, xl, 19);
327
- var c1_lo = rotr64_lo(xl, xh, 29); // 61
328
- var c2_lo = shr64_lo(xh, xl, 6);
329
-
330
- var r = c0_lo ^ c1_lo ^ c2_lo;
331
- if (r < 0)
332
- r += 0x100000000;
333
- return r;
334
- }
335
-
336
- export { _512 as _ };
@@ -1,53 +0,0 @@
1
- import { __exports as common } from '../../../../../_virtual/common2.js';
2
- import '../utils.js';
3
- import { __exports as utils$1 } from '../../../../../_virtual/utils3.js';
4
-
5
- var utils = utils$1;
6
- var rotr32 = utils.rotr32;
7
-
8
- function ft_1(s, x, y, z) {
9
- if (s === 0)
10
- return ch32(x, y, z);
11
- if (s === 1 || s === 3)
12
- return p32(x, y, z);
13
- if (s === 2)
14
- return maj32(x, y, z);
15
- }
16
- common.ft_1 = ft_1;
17
-
18
- function ch32(x, y, z) {
19
- return (x & y) ^ ((~x) & z);
20
- }
21
- common.ch32 = ch32;
22
-
23
- function maj32(x, y, z) {
24
- return (x & y) ^ (x & z) ^ (y & z);
25
- }
26
- common.maj32 = maj32;
27
-
28
- function p32(x, y, z) {
29
- return x ^ y ^ z;
30
- }
31
- common.p32 = p32;
32
-
33
- function s0_256(x) {
34
- return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);
35
- }
36
- common.s0_256 = s0_256;
37
-
38
- function s1_256(x) {
39
- return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);
40
- }
41
- common.s1_256 = s1_256;
42
-
43
- function g0_256(x) {
44
- return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3);
45
- }
46
- common.g0_256 = g0_256;
47
-
48
- function g1_256(x) {
49
- return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10);
50
- }
51
- common.g1_256 = g1_256;
52
-
53
- export { common as default };
@@ -1,14 +0,0 @@
1
- import { __exports as sha } from '../../../../_virtual/sha.js';
2
- import { _ as _1 } from './sha/1.js';
3
- import { _ as _224 } from './sha/224.js';
4
- import { _ as _256 } from './sha/256.js';
5
- import { _ as _384 } from './sha/384.js';
6
- import { _ as _512 } from './sha/512.js';
7
-
8
- sha.sha1 = _1;
9
- sha.sha224 = _224;
10
- sha.sha256 = _256;
11
- sha.sha384 = _384;
12
- sha.sha512 = _512;
13
-
14
- export { sha as default };
@@ -1,282 +0,0 @@
1
- import { __exports as utils } from '../../../../_virtual/utils3.js';
2
- import { m as minimalisticAssert } from '../../../minimalistic-assert/index.js';
3
- import { i as inherits_browserExports } from '../../../inherits/inherits_browser.js';
4
-
5
- var assert = minimalisticAssert;
6
- var inherits = inherits_browserExports;
7
-
8
- utils.inherits = inherits;
9
-
10
- function isSurrogatePair(msg, i) {
11
- if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) {
12
- return false;
13
- }
14
- if (i < 0 || i + 1 >= msg.length) {
15
- return false;
16
- }
17
- return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00;
18
- }
19
-
20
- function toArray(msg, enc) {
21
- if (Array.isArray(msg))
22
- return msg.slice();
23
- if (!msg)
24
- return [];
25
- var res = [];
26
- if (typeof msg === 'string') {
27
- if (!enc) {
28
- // Inspired by stringToUtf8ByteArray() in closure-library by Google
29
- // https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143
30
- // Apache License 2.0
31
- // https://github.com/google/closure-library/blob/master/LICENSE
32
- var p = 0;
33
- for (var i = 0; i < msg.length; i++) {
34
- var c = msg.charCodeAt(i);
35
- if (c < 128) {
36
- res[p++] = c;
37
- } else if (c < 2048) {
38
- res[p++] = (c >> 6) | 192;
39
- res[p++] = (c & 63) | 128;
40
- } else if (isSurrogatePair(msg, i)) {
41
- c = 0x10000 + ((c & 0x03FF) << 10) + (msg.charCodeAt(++i) & 0x03FF);
42
- res[p++] = (c >> 18) | 240;
43
- res[p++] = ((c >> 12) & 63) | 128;
44
- res[p++] = ((c >> 6) & 63) | 128;
45
- res[p++] = (c & 63) | 128;
46
- } else {
47
- res[p++] = (c >> 12) | 224;
48
- res[p++] = ((c >> 6) & 63) | 128;
49
- res[p++] = (c & 63) | 128;
50
- }
51
- }
52
- } else if (enc === 'hex') {
53
- msg = msg.replace(/[^a-z0-9]+/ig, '');
54
- if (msg.length % 2 !== 0)
55
- msg = '0' + msg;
56
- for (i = 0; i < msg.length; i += 2)
57
- res.push(parseInt(msg[i] + msg[i + 1], 16));
58
- }
59
- } else {
60
- for (i = 0; i < msg.length; i++)
61
- res[i] = msg[i] | 0;
62
- }
63
- return res;
64
- }
65
- utils.toArray = toArray;
66
-
67
- function toHex(msg) {
68
- var res = '';
69
- for (var i = 0; i < msg.length; i++)
70
- res += zero2(msg[i].toString(16));
71
- return res;
72
- }
73
- utils.toHex = toHex;
74
-
75
- function htonl(w) {
76
- var res = (w >>> 24) |
77
- ((w >>> 8) & 0xff00) |
78
- ((w << 8) & 0xff0000) |
79
- ((w & 0xff) << 24);
80
- return res >>> 0;
81
- }
82
- utils.htonl = htonl;
83
-
84
- function toHex32(msg, endian) {
85
- var res = '';
86
- for (var i = 0; i < msg.length; i++) {
87
- var w = msg[i];
88
- if (endian === 'little')
89
- w = htonl(w);
90
- res += zero8(w.toString(16));
91
- }
92
- return res;
93
- }
94
- utils.toHex32 = toHex32;
95
-
96
- function zero2(word) {
97
- if (word.length === 1)
98
- return '0' + word;
99
- else
100
- return word;
101
- }
102
- utils.zero2 = zero2;
103
-
104
- function zero8(word) {
105
- if (word.length === 7)
106
- return '0' + word;
107
- else if (word.length === 6)
108
- return '00' + word;
109
- else if (word.length === 5)
110
- return '000' + word;
111
- else if (word.length === 4)
112
- return '0000' + word;
113
- else if (word.length === 3)
114
- return '00000' + word;
115
- else if (word.length === 2)
116
- return '000000' + word;
117
- else if (word.length === 1)
118
- return '0000000' + word;
119
- else
120
- return word;
121
- }
122
- utils.zero8 = zero8;
123
-
124
- function join32(msg, start, end, endian) {
125
- var len = end - start;
126
- assert(len % 4 === 0);
127
- var res = new Array(len / 4);
128
- for (var i = 0, k = start; i < res.length; i++, k += 4) {
129
- var w;
130
- if (endian === 'big')
131
- w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3];
132
- else
133
- w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k];
134
- res[i] = w >>> 0;
135
- }
136
- return res;
137
- }
138
- utils.join32 = join32;
139
-
140
- function split32(msg, endian) {
141
- var res = new Array(msg.length * 4);
142
- for (var i = 0, k = 0; i < msg.length; i++, k += 4) {
143
- var m = msg[i];
144
- if (endian === 'big') {
145
- res[k] = m >>> 24;
146
- res[k + 1] = (m >>> 16) & 0xff;
147
- res[k + 2] = (m >>> 8) & 0xff;
148
- res[k + 3] = m & 0xff;
149
- } else {
150
- res[k + 3] = m >>> 24;
151
- res[k + 2] = (m >>> 16) & 0xff;
152
- res[k + 1] = (m >>> 8) & 0xff;
153
- res[k] = m & 0xff;
154
- }
155
- }
156
- return res;
157
- }
158
- utils.split32 = split32;
159
-
160
- function rotr32(w, b) {
161
- return (w >>> b) | (w << (32 - b));
162
- }
163
- utils.rotr32 = rotr32;
164
-
165
- function rotl32(w, b) {
166
- return (w << b) | (w >>> (32 - b));
167
- }
168
- utils.rotl32 = rotl32;
169
-
170
- function sum32(a, b) {
171
- return (a + b) >>> 0;
172
- }
173
- utils.sum32 = sum32;
174
-
175
- function sum32_3(a, b, c) {
176
- return (a + b + c) >>> 0;
177
- }
178
- utils.sum32_3 = sum32_3;
179
-
180
- function sum32_4(a, b, c, d) {
181
- return (a + b + c + d) >>> 0;
182
- }
183
- utils.sum32_4 = sum32_4;
184
-
185
- function sum32_5(a, b, c, d, e) {
186
- return (a + b + c + d + e) >>> 0;
187
- }
188
- utils.sum32_5 = sum32_5;
189
-
190
- function sum64(buf, pos, ah, al) {
191
- var bh = buf[pos];
192
- var bl = buf[pos + 1];
193
-
194
- var lo = (al + bl) >>> 0;
195
- var hi = (lo < al ? 1 : 0) + ah + bh;
196
- buf[pos] = hi >>> 0;
197
- buf[pos + 1] = lo;
198
- }
199
- utils.sum64 = sum64;
200
-
201
- function sum64_hi(ah, al, bh, bl) {
202
- var lo = (al + bl) >>> 0;
203
- var hi = (lo < al ? 1 : 0) + ah + bh;
204
- return hi >>> 0;
205
- }
206
- utils.sum64_hi = sum64_hi;
207
-
208
- function sum64_lo(ah, al, bh, bl) {
209
- var lo = al + bl;
210
- return lo >>> 0;
211
- }
212
- utils.sum64_lo = sum64_lo;
213
-
214
- function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {
215
- var carry = 0;
216
- var lo = al;
217
- lo = (lo + bl) >>> 0;
218
- carry += lo < al ? 1 : 0;
219
- lo = (lo + cl) >>> 0;
220
- carry += lo < cl ? 1 : 0;
221
- lo = (lo + dl) >>> 0;
222
- carry += lo < dl ? 1 : 0;
223
-
224
- var hi = ah + bh + ch + dh + carry;
225
- return hi >>> 0;
226
- }
227
- utils.sum64_4_hi = sum64_4_hi;
228
-
229
- function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {
230
- var lo = al + bl + cl + dl;
231
- return lo >>> 0;
232
- }
233
- utils.sum64_4_lo = sum64_4_lo;
234
-
235
- function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
236
- var carry = 0;
237
- var lo = al;
238
- lo = (lo + bl) >>> 0;
239
- carry += lo < al ? 1 : 0;
240
- lo = (lo + cl) >>> 0;
241
- carry += lo < cl ? 1 : 0;
242
- lo = (lo + dl) >>> 0;
243
- carry += lo < dl ? 1 : 0;
244
- lo = (lo + el) >>> 0;
245
- carry += lo < el ? 1 : 0;
246
-
247
- var hi = ah + bh + ch + dh + eh + carry;
248
- return hi >>> 0;
249
- }
250
- utils.sum64_5_hi = sum64_5_hi;
251
-
252
- function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
253
- var lo = al + bl + cl + dl + el;
254
-
255
- return lo >>> 0;
256
- }
257
- utils.sum64_5_lo = sum64_5_lo;
258
-
259
- function rotr64_hi(ah, al, num) {
260
- var r = (al << (32 - num)) | (ah >>> num);
261
- return r >>> 0;
262
- }
263
- utils.rotr64_hi = rotr64_hi;
264
-
265
- function rotr64_lo(ah, al, num) {
266
- var r = (ah << (32 - num)) | (al >>> num);
267
- return r >>> 0;
268
- }
269
- utils.rotr64_lo = rotr64_lo;
270
-
271
- function shr64_hi(ah, al, num) {
272
- return ah >>> num;
273
- }
274
- utils.shr64_hi = shr64_hi;
275
-
276
- function shr64_lo(ah, al, num) {
277
- var r = (ah << (32 - num)) | (al >>> num);
278
- return r >>> 0;
279
- }
280
- utils.shr64_lo = shr64_lo;
281
-
282
- export { utils as default };
@@ -1,33 +0,0 @@
1
- import { getDefaultExportFromCjs } from '../../../_virtual/_commonjsHelpers.js';
2
- import { __exports as hash$1 } from '../../../_virtual/hash.js';
3
- import './hash/utils.js';
4
- import './hash/common.js';
5
- import './hash/sha.js';
6
- import './hash/ripemd.js';
7
- import { h as hmac } from './hash/hmac.js';
8
- import { __exports as utils } from '../../../_virtual/utils3.js';
9
- import { __exports as common } from '../../../_virtual/common.js';
10
- import { __exports as sha } from '../../../_virtual/sha.js';
11
- import { __exports as ripemd } from '../../../_virtual/ripemd.js';
12
-
13
- (function (exports) {
14
- var hash = exports;
15
-
16
- hash.utils = utils;
17
- hash.common = common;
18
- hash.sha = sha;
19
- hash.ripemd = ripemd;
20
- hash.hmac = hmac;
21
-
22
- // Proxy hash functions to the main object
23
- hash.sha1 = hash.sha.sha1;
24
- hash.sha256 = hash.sha.sha256;
25
- hash.sha224 = hash.sha.sha224;
26
- hash.sha384 = hash.sha.sha384;
27
- hash.sha512 = hash.sha.sha512;
28
- hash.ripemd160 = hash.ripemd.ripemd160;
29
- } (hash$1));
30
-
31
- var hash = /*@__PURE__*/getDefaultExportFromCjs(hash$1);
32
-
33
- export { hash as default };