@tonysamperi/krypto 1.0.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 (196) hide show
  1. package/LICENCE +21 -0
  2. package/README.md +119 -0
  3. package/dist/cjs/algo/aes.class.d.cts +16 -0
  4. package/dist/cjs/algo/des.class.d.cts +19 -0
  5. package/dist/cjs/algo/index.d.cts +7 -0
  6. package/dist/cjs/algo/md5.class.d.cts +13 -0
  7. package/dist/cjs/algo/sha1.class.d.cts +9 -0
  8. package/dist/cjs/algo/sha256.class.d.cts +9 -0
  9. package/dist/cjs/algo/sha512.class.d.cts +9 -0
  10. package/dist/cjs/algo/triple-des.class.d.cts +16 -0
  11. package/dist/cjs/enc/base64.class.d.cts +31 -0
  12. package/dist/cjs/enc/encoder.model.d.cts +6 -0
  13. package/dist/cjs/enc/hex.class.d.cts +27 -0
  14. package/dist/cjs/enc/index.d.cts +6 -0
  15. package/dist/cjs/enc/latin1.class.d.cts +27 -0
  16. package/dist/cjs/enc/utf16.class.d.cts +28 -0
  17. package/dist/cjs/enc/utf8.class.d.cts +28 -0
  18. package/dist/cjs/format/formatter.interface.d.cts +5 -0
  19. package/dist/cjs/format/open-ssl.class.d.cts +27 -0
  20. package/dist/cjs/helpers/aes.helper.d.cts +2 -0
  21. package/dist/cjs/helpers/des.helper.d.cts +2 -0
  22. package/dist/cjs/helpers/index.d.cts +7 -0
  23. package/dist/cjs/helpers/md5.helper.d.cts +2 -0
  24. package/dist/cjs/helpers/sha1.helper.d.cts +2 -0
  25. package/dist/cjs/helpers/sha256.helper.d.cts +2 -0
  26. package/dist/cjs/helpers/sha512.helper.d.cts +2 -0
  27. package/dist/cjs/helpers/triple-des.helper.d.cts +2 -0
  28. package/dist/cjs/index.cjs +1 -0
  29. package/dist/cjs/index.d.cts +7 -0
  30. package/dist/cjs/kdf/evpkdf.class.d.cts +42 -0
  31. package/dist/cjs/kdf/index.d.cts +3 -0
  32. package/dist/cjs/kdf/kdf.model.d.cts +7 -0
  33. package/dist/cjs/kdf/open-ssl-kdf.class.d.cts +21 -0
  34. package/dist/cjs/kdf/pbkdf2.class.d.cts +18 -0
  35. package/dist/cjs/lib/block-cipher.class.d.cts +13 -0
  36. package/dist/cjs/lib/buffered-block-algorithm-config.interface.d.cts +13 -0
  37. package/dist/cjs/lib/buffered-block-algorithm.class.d.cts +54 -0
  38. package/dist/cjs/lib/cipher-helper.class.d.cts +10 -0
  39. package/dist/cjs/lib/cipher-params.class.d.cts +53 -0
  40. package/dist/cjs/lib/cipher.class.d.cts +112 -0
  41. package/dist/cjs/lib/hasher-constructor.type.d.cts +3 -0
  42. package/dist/cjs/lib/hasher-helper.type.d.cts +3 -0
  43. package/dist/cjs/lib/hasher.class.d.cts +58 -0
  44. package/dist/cjs/lib/hmac.class.d.cts +11 -0
  45. package/dist/cjs/lib/index.d.cts +8 -0
  46. package/dist/cjs/lib/password-based-cipher.class.d.cts +54 -0
  47. package/dist/cjs/lib/serializable-cipher.class.d.cts +73 -0
  48. package/dist/cjs/lib/word-array.class.d.cts +75 -0
  49. package/dist/cjs/lib/x64-word-array.class.d.cts +10 -0
  50. package/dist/cjs/lib/x64-word.class.d.cts +14 -0
  51. package/dist/cjs/mode/block-cipher-mode-algorithm.class.d.cts +20 -0
  52. package/dist/cjs/mode/block-cipher-mode.class.d.cts +28 -0
  53. package/dist/cjs/mode/cbc/cbc-decryptor.class.d.cts +17 -0
  54. package/dist/cjs/mode/cbc/cbc-encryptor.class.d.cts +17 -0
  55. package/dist/cjs/mode/cbc/cbc.class.d.cts +10 -0
  56. package/dist/cjs/mode/ctr/ctr-decryptor.class.d.cts +3 -0
  57. package/dist/cjs/mode/ctr/ctr-encryptor.class.d.cts +16 -0
  58. package/dist/cjs/mode/ctr/ctr.class.d.cts +10 -0
  59. package/dist/cjs/mode/ecb/ecb-decryptor.class.d.cts +14 -0
  60. package/dist/cjs/mode/ecb/ecb-encryptor.class.d.cts +14 -0
  61. package/dist/cjs/mode/ecb/ecb.class.d.cts +10 -0
  62. package/dist/cjs/mode/index.d.cts +11 -0
  63. package/dist/cjs/pad/index.d.cts +4 -0
  64. package/dist/cjs/pad/no-padding.class.d.cts +25 -0
  65. package/dist/cjs/pad/padding.model.d.cts +6 -0
  66. package/dist/cjs/pad/pkcs7.class.d.cts +25 -0
  67. package/dist/cjs/pad/zero-padding.class.d.cts +25 -0
  68. package/dist/esm/algo/aes.class.d.ts +16 -0
  69. package/dist/esm/algo/aes.class.js +138 -0
  70. package/dist/esm/algo/des.class.d.ts +19 -0
  71. package/dist/esm/algo/des.class.js +733 -0
  72. package/dist/esm/algo/index.d.ts +7 -0
  73. package/dist/esm/algo/index.js +7 -0
  74. package/dist/esm/algo/md5.class.d.ts +13 -0
  75. package/dist/esm/algo/md5.class.js +137 -0
  76. package/dist/esm/algo/sha1.class.d.ts +9 -0
  77. package/dist/esm/algo/sha1.class.js +66 -0
  78. package/dist/esm/algo/sha256.class.d.ts +9 -0
  79. package/dist/esm/algo/sha256.class.js +96 -0
  80. package/dist/esm/algo/sha512.class.d.ts +9 -0
  81. package/dist/esm/algo/sha512.class.js +221 -0
  82. package/dist/esm/algo/triple-des.class.d.ts +16 -0
  83. package/dist/esm/algo/triple-des.class.js +37 -0
  84. package/dist/esm/enc/base64.class.d.ts +31 -0
  85. package/dist/esm/enc/base64.class.js +80 -0
  86. package/dist/esm/enc/encoder.model.d.ts +6 -0
  87. package/dist/esm/enc/encoder.model.js +5 -0
  88. package/dist/esm/enc/hex.class.d.ts +27 -0
  89. package/dist/esm/enc/hex.class.js +45 -0
  90. package/dist/esm/enc/index.d.ts +6 -0
  91. package/dist/esm/enc/index.js +6 -0
  92. package/dist/esm/enc/latin1.class.d.ts +27 -0
  93. package/dist/esm/enc/latin1.class.js +44 -0
  94. package/dist/esm/enc/utf16.class.d.ts +28 -0
  95. package/dist/esm/enc/utf16.class.js +46 -0
  96. package/dist/esm/enc/utf8.class.d.ts +28 -0
  97. package/dist/esm/enc/utf8.class.js +39 -0
  98. package/dist/esm/format/formatter.interface.d.ts +5 -0
  99. package/dist/esm/format/formatter.interface.js +0 -0
  100. package/dist/esm/format/open-ssl.class.d.ts +27 -0
  101. package/dist/esm/format/open-ssl.class.js +57 -0
  102. package/dist/esm/helpers/aes.helper.d.ts +2 -0
  103. package/dist/esm/helpers/aes.helper.js +6 -0
  104. package/dist/esm/helpers/des.helper.d.ts +2 -0
  105. package/dist/esm/helpers/des.helper.js +6 -0
  106. package/dist/esm/helpers/index.d.ts +7 -0
  107. package/dist/esm/helpers/index.js +16 -0
  108. package/dist/esm/helpers/md5.helper.d.ts +2 -0
  109. package/dist/esm/helpers/md5.helper.js +6 -0
  110. package/dist/esm/helpers/sha1.helper.d.ts +2 -0
  111. package/dist/esm/helpers/sha1.helper.js +6 -0
  112. package/dist/esm/helpers/sha256.helper.d.ts +2 -0
  113. package/dist/esm/helpers/sha256.helper.js +6 -0
  114. package/dist/esm/helpers/sha512.helper.d.ts +2 -0
  115. package/dist/esm/helpers/sha512.helper.js +6 -0
  116. package/dist/esm/helpers/triple-des.helper.d.ts +2 -0
  117. package/dist/esm/helpers/triple-des.helper.js +6 -0
  118. package/dist/esm/index.d.ts +7 -0
  119. package/dist/esm/index.js +43 -0
  120. package/dist/esm/kdf/evpkdf.class.d.ts +42 -0
  121. package/dist/esm/kdf/evpkdf.class.js +59 -0
  122. package/dist/esm/kdf/index.d.ts +3 -0
  123. package/dist/esm/kdf/index.js +3 -0
  124. package/dist/esm/kdf/kdf.model.d.ts +7 -0
  125. package/dist/esm/kdf/kdf.model.js +5 -0
  126. package/dist/esm/kdf/open-ssl-kdf.class.d.ts +21 -0
  127. package/dist/esm/kdf/open-ssl-kdf.class.js +32 -0
  128. package/dist/esm/kdf/pbkdf2.class.d.ts +18 -0
  129. package/dist/esm/kdf/pbkdf2.class.js +43 -0
  130. package/dist/esm/lib/block-cipher.class.d.ts +13 -0
  131. package/dist/esm/lib/block-cipher.class.js +55 -0
  132. package/dist/esm/lib/buffered-block-algorithm-config.interface.d.ts +13 -0
  133. package/dist/esm/lib/buffered-block-algorithm-config.interface.js +0 -0
  134. package/dist/esm/lib/buffered-block-algorithm.class.d.ts +54 -0
  135. package/dist/esm/lib/buffered-block-algorithm.class.js +99 -0
  136. package/dist/esm/lib/cipher-helper.class.d.ts +10 -0
  137. package/dist/esm/lib/cipher-helper.class.js +24 -0
  138. package/dist/esm/lib/cipher-params.class.d.ts +53 -0
  139. package/dist/esm/lib/cipher-params.class.js +89 -0
  140. package/dist/esm/lib/cipher.class.d.ts +112 -0
  141. package/dist/esm/lib/cipher.class.js +112 -0
  142. package/dist/esm/lib/hasher-constructor.type.d.ts +3 -0
  143. package/dist/esm/lib/hasher-constructor.type.js +0 -0
  144. package/dist/esm/lib/hasher-helper.type.d.ts +3 -0
  145. package/dist/esm/lib/hasher-helper.type.js +0 -0
  146. package/dist/esm/lib/hasher.class.d.ts +58 -0
  147. package/dist/esm/lib/hasher.class.js +77 -0
  148. package/dist/esm/lib/hmac.class.d.ts +11 -0
  149. package/dist/esm/lib/hmac.class.js +39 -0
  150. package/dist/esm/lib/index.d.ts +8 -0
  151. package/dist/esm/lib/index.js +18 -0
  152. package/dist/esm/lib/password-based-cipher.class.d.ts +54 -0
  153. package/dist/esm/lib/password-based-cipher.class.js +92 -0
  154. package/dist/esm/lib/serializable-cipher.class.d.ts +73 -0
  155. package/dist/esm/lib/serializable-cipher.class.js +108 -0
  156. package/dist/esm/lib/word-array.class.d.ts +75 -0
  157. package/dist/esm/lib/word-array.class.js +123 -0
  158. package/dist/esm/lib/x64-word-array.class.d.ts +10 -0
  159. package/dist/esm/lib/x64-word-array.class.js +25 -0
  160. package/dist/esm/lib/x64-word.class.d.ts +14 -0
  161. package/dist/esm/lib/x64-word.class.js +47 -0
  162. package/dist/esm/mode/block-cipher-mode-algorithm.class.d.ts +20 -0
  163. package/dist/esm/mode/block-cipher-mode-algorithm.class.js +22 -0
  164. package/dist/esm/mode/block-cipher-mode.class.d.ts +28 -0
  165. package/dist/esm/mode/block-cipher-mode.class.js +36 -0
  166. package/dist/esm/mode/cbc/cbc-decryptor.class.d.ts +17 -0
  167. package/dist/esm/mode/cbc/cbc-decryptor.class.js +40 -0
  168. package/dist/esm/mode/cbc/cbc-encryptor.class.d.ts +17 -0
  169. package/dist/esm/mode/cbc/cbc-encryptor.class.js +39 -0
  170. package/dist/esm/mode/cbc/cbc.class.d.ts +10 -0
  171. package/dist/esm/mode/cbc/cbc.class.js +10 -0
  172. package/dist/esm/mode/ctr/ctr-decryptor.class.d.ts +3 -0
  173. package/dist/esm/mode/ctr/ctr-decryptor.class.js +6 -0
  174. package/dist/esm/mode/ctr/ctr-encryptor.class.d.ts +16 -0
  175. package/dist/esm/mode/ctr/ctr-encryptor.class.js +33 -0
  176. package/dist/esm/mode/ctr/ctr.class.d.ts +10 -0
  177. package/dist/esm/mode/ctr/ctr.class.js +10 -0
  178. package/dist/esm/mode/ecb/ecb-decryptor.class.d.ts +14 -0
  179. package/dist/esm/mode/ecb/ecb-decryptor.class.js +19 -0
  180. package/dist/esm/mode/ecb/ecb-encryptor.class.d.ts +14 -0
  181. package/dist/esm/mode/ecb/ecb-encryptor.class.js +19 -0
  182. package/dist/esm/mode/ecb/ecb.class.d.ts +10 -0
  183. package/dist/esm/mode/ecb/ecb.class.js +10 -0
  184. package/dist/esm/mode/index.d.ts +11 -0
  185. package/dist/esm/mode/index.js +24 -0
  186. package/dist/esm/pad/index.d.ts +4 -0
  187. package/dist/esm/pad/index.js +8 -0
  188. package/dist/esm/pad/no-padding.class.d.ts +25 -0
  189. package/dist/esm/pad/no-padding.class.js +28 -0
  190. package/dist/esm/pad/padding.model.d.ts +6 -0
  191. package/dist/esm/pad/padding.model.js +5 -0
  192. package/dist/esm/pad/pkcs7.class.d.ts +25 -0
  193. package/dist/esm/pad/pkcs7.class.js +40 -0
  194. package/dist/esm/pad/zero-padding.class.d.ts +25 -0
  195. package/dist/esm/pad/zero-padding.class.js +38 -0
  196. package/package.json +82 -0
package/LICENCE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Tony Samperi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,119 @@
1
+ # Krypto
2
+ TypeScript library of crypto standards, derived from [crypto-js](https://github.com/brix/crypto-js)
3
+
4
+ [![MIT Licence][licence-image]][licence]
5
+ [![NPM version][npm-version-image]][npm-url]
6
+ [![Size][size-url]][size-unpkg-url]
7
+ ![PRs welcome][contributing-image]
8
+ [![Build Status][gh-actions-image]][gh-actions-url]
9
+
10
+ I've been using crypto-js, but it was recently discontinued.
11
+ It's not for that reason, but let's be honest: you always hated it for its typings.
12
+ Man, seriously, a nightmare if you were in modern projects.
13
+ I've been recently exploring ESM modules, so I've been making all of my libs **tree-shakeable**.
14
+ Crypto-js is a not-so-tiny brick. CommonJS is ok, but there was just no way of not having those 200KBs in your bundles.
15
+
16
+ Well **not anymore**!!!
17
+
18
+ The syntax is very similar to the one in crypto-js, except that now all the entities are classes, so it's even more versatile.
19
+ Little downside, big upside IMHO.
20
+ The downside is that I had to use other names for the helpers offered by crypto-js such as SHA1, SHA256, etc.
21
+
22
+ Nothing impossible in any case: how SHA1 is the hasher class (that you can optionally extend), while the helper is just called `sha1Helper`.
23
+
24
+ It's easy, isn't it?
25
+
26
+ ## You can import whatever you want from the root
27
+
28
+ ```js
29
+ import {sha256Helper, Utf8} from "@tonysamperi/crypto";
30
+
31
+ const myHash = sha256Helper(Utf8.parse(value)).toString();
32
+ ```
33
+
34
+ ## Preview releases
35
+ With v6 I introduced a new release tag `next`.
36
+ These versions are basically release candidates that can be tried out before they get released.
37
+ The next version tag gets cleared out automatically upon release of the latest stable version.
38
+
39
+ The beta releases instead, like it's always been, represent **unstable** releases, and they're subject to dramatic changes.
40
+
41
+ ## Features
42
+
43
+ I started with a few features that I personally need, but I will migrate others once a while.
44
+ One that I have in mind is TripleDES.
45
+
46
+ ### ALGORITHMS (including helpers to simplify usage)
47
+
48
+ * AES
49
+ * DES
50
+ * MD5
51
+ * SHA1
52
+ * SHA256
53
+ * SHA512
54
+ * TripleDES
55
+
56
+ ### KDF
57
+
58
+ * pbkdf2
59
+ * evpkdf
60
+
61
+ ### ENCODING
62
+
63
+ * base64
64
+ * hex
65
+ * latin1
66
+ * utf16
67
+ * utf8
68
+
69
+ ### MODE
70
+
71
+ * CBC
72
+ * CTR
73
+ * ECB
74
+
75
+ ### PADDING
76
+
77
+ * nopadding
78
+ * pkcs7
79
+ * zeropadding
80
+
81
+ ## Usage
82
+
83
+ ### Via npm
84
+
85
+ `npm i @tonysamperi/crypto --save`
86
+
87
+ then
88
+
89
+ ```typescript
90
+ import {Hex} from "ts-luxon";
91
+
92
+ const myWord = Hex.parse("1a2b3c");
93
+ ```
94
+
95
+ ## THANKS TO
96
+
97
+ [Evan Vosberg](https://github.com/brix) for creating and maintaining crypto-js
98
+
99
+ # DOCS
100
+
101
+ COMING SOON
102
+
103
+ ---
104
+
105
+ [//]: # (keep these ordered alphabetically)
106
+
107
+ [contributing-image]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg
108
+
109
+ [gh-actions-url]: https://github.com/tonysamperi/krypto/actions?query=workflow%3A%22Test%22
110
+ [gh-actions-image]: https://github.com/tonysamperi/krypto/workflows/Test/badge.svg?branch=master
111
+
112
+ [licence-image]: https://img.shields.io/badge/license-MIT-blue.svg
113
+ [licence]: LICENCE
114
+
115
+ [npm-url]: https://npmjs.org/package/@tonysamperi%3Dkrypto
116
+ [npm-version-image]: https://badge.fury.io/js/@tonysamperi%3Dkrypto.svg
117
+
118
+ [size-url]: https://img.shields.io/bundlephobia/minzip/@tonysamperi/krypto
119
+ [size-unpkg-url]: https://unpkg.com/@tonysamperi/krypto@latest/dist/cjs/index.cjs
@@ -0,0 +1,16 @@
1
+ import { BlockCipher } from "../lib/block-cipher.class.cjs";
2
+ import { WordArray } from "../lib/word-array.class.cjs";
3
+ import { BufferedBlockAlgorithmConfig } from "../lib/buffered-block-algorithm-config.interface.cjs";
4
+ export declare class AES extends BlockCipher {
5
+ static keySize: number;
6
+ protected _invKeySchedule: number[];
7
+ protected _key: WordArray;
8
+ protected _keyPriorReset: WordArray;
9
+ protected _keySchedule: number[];
10
+ protected _nRounds: number;
11
+ constructor(xformMode: number, key: WordArray, cfg?: BufferedBlockAlgorithmConfig);
12
+ decryptBlock(m: number[], offset: number): void;
13
+ encryptBlock(m: number[], offset: number): void;
14
+ reset(): void;
15
+ protected _doCryptBlock(m: number[], offset: number, keySchedule: number[], subMix0: number[], subMix1: number[], subMix2: number[], subMix3: number[], sbox: number[]): void;
16
+ }
@@ -0,0 +1,19 @@
1
+ import { BlockCipher } from "../lib/block-cipher.class.cjs";
2
+ import { WordArray } from "../lib/word-array.class.cjs";
3
+ import { BufferedBlockAlgorithmConfig } from "../lib/buffered-block-algorithm-config.interface.cjs";
4
+ export declare class DES extends BlockCipher {
5
+ static blockSize: number;
6
+ static ivSize: number;
7
+ static keySize: number;
8
+ protected _invSubKeys: number[][];
9
+ protected _lBlock: number;
10
+ protected _rBlock: number;
11
+ protected _subKeys: number[][];
12
+ constructor(xformMode: number, key: WordArray, cfg?: BufferedBlockAlgorithmConfig);
13
+ decryptBlock(m: number[], offset: number): void;
14
+ encryptBlock(m: number[], offset: number): void;
15
+ reset(): void;
16
+ protected _doCryptBlock(m: number[], offset: number, subKeys: number[][]): void;
17
+ protected _exchangeLR(offset: number, mask: number): void;
18
+ protected _exchangeRL(offset: number, mask: number): void;
19
+ }
@@ -0,0 +1,7 @@
1
+ export * from "./aes.class.cjs";
2
+ export * from "./des.class.cjs";
3
+ export * from "./md5.class.cjs";
4
+ export * from "./triple-des.class.cjs";
5
+ export * from "./sha1.class.cjs";
6
+ export * from "./sha256.class.cjs";
7
+ export * from "./sha512.class.cjs";
@@ -0,0 +1,13 @@
1
+ import { Hasher } from "../lib/hasher.class.cjs";
2
+ import { WordArray } from "../lib/word-array.class.cjs";
3
+ export declare class MD5 extends Hasher {
4
+ get hash(): WordArray;
5
+ protected _hash: WordArray;
6
+ static FF(a: number, b: number, c: number, d: number, x: number, s: number, t: number): number;
7
+ static GG(a: number, b: number, c: number, d: number, x: number, s: number, t: number): number;
8
+ static HH(a: number, b: number, c: number, d: number, x: number, s: number, t: number): number;
9
+ static II(a: number, b: number, c: number, d: number, x: number, s: number, t: number): number;
10
+ reset(): void;
11
+ protected _doFinalize(): WordArray;
12
+ protected _doProcessBlock(m: number[], offset: number): void;
13
+ }
@@ -0,0 +1,9 @@
1
+ import { Hasher } from "../lib/hasher.class.cjs";
2
+ import { WordArray } from "../lib/word-array.class.cjs";
3
+ export declare class SHA1 extends Hasher {
4
+ get hash(): WordArray;
5
+ protected _hash: WordArray;
6
+ reset(): void;
7
+ protected _doFinalize(): WordArray;
8
+ protected _doProcessBlock(m: number[], offset: number): void;
9
+ }
@@ -0,0 +1,9 @@
1
+ import { Hasher } from "../lib/hasher.class.cjs";
2
+ import { WordArray } from "../lib/word-array.class.cjs";
3
+ export declare class SHA256 extends Hasher {
4
+ private _hash;
5
+ constructor();
6
+ reset(): void;
7
+ protected _doFinalize(): WordArray;
8
+ protected _doProcessBlock(m: number[], offset: number): void;
9
+ }
@@ -0,0 +1,9 @@
1
+ import { Hasher } from "../lib/hasher.class.cjs";
2
+ import { WordArray } from "../lib/word-array.class.cjs";
3
+ export declare class SHA512 extends Hasher {
4
+ private _hash;
5
+ constructor();
6
+ reset(): void;
7
+ protected _doFinalize(): WordArray;
8
+ protected _doProcessBlock(m: number[], offset: number): void;
9
+ }
@@ -0,0 +1,16 @@
1
+ import { BlockCipher } from "../lib/block-cipher.class.cjs";
2
+ import { WordArray } from "../lib/word-array.class.cjs";
3
+ import { BufferedBlockAlgorithmConfig } from "../lib/buffered-block-algorithm-config.interface.cjs";
4
+ import { DES } from "./des.class.cjs";
5
+ export declare class TripleDES extends BlockCipher {
6
+ static blockSize: number;
7
+ static ivSize: number;
8
+ static keySize: number;
9
+ protected _des1: DES;
10
+ protected _des2: DES;
11
+ protected _des3: DES;
12
+ constructor(xformMode: number, key: WordArray, cfg?: BufferedBlockAlgorithmConfig);
13
+ decryptBlock(m: number[], offset: number): void;
14
+ encryptBlock(m: number[], offset: number): void;
15
+ reset(): void;
16
+ }
@@ -0,0 +1,31 @@
1
+ import { WordArray } from "../lib/word-array.class.cjs";
2
+ import { AbstractEncoder } from "./encoder.model.cjs";
3
+ export declare class Base64 implements AbstractEncoder {
4
+ protected static _map: string;
5
+ protected static _reverseMap: number[] | undefined;
6
+ /**
7
+ * Converts a Base64 string to a word array.
8
+ *
9
+ * @param base64Str The Base64 string.
10
+ *
11
+ * @return The word array.
12
+ *
13
+ * @example
14
+ *
15
+ * let wordArray = Base64.parse(base64String);
16
+ */
17
+ static parse(base64Str: string): WordArray;
18
+ static parseLoop(base64Str: string, base64StrLength: number, reverseMap: number[]): WordArray;
19
+ /**
20
+ * Converts a word array to a Base64 string.
21
+ *
22
+ * @param wordArray The word array.
23
+ *
24
+ * @return The Base64 string.
25
+ *
26
+ * @example
27
+ *
28
+ * let base64String = Base64.stringify(wordArray);
29
+ */
30
+ static stringify(wordArray: WordArray): string;
31
+ }
@@ -0,0 +1,6 @@
1
+ import { WordArray } from "../lib/word-array.class.cjs";
2
+ export declare abstract class AbstractEncoder {
3
+ static parse: (word: string) => WordArray;
4
+ static stringify: (word: WordArray) => string;
5
+ }
6
+ export type Encoder = typeof AbstractEncoder;
@@ -0,0 +1,27 @@
1
+ import { WordArray } from "../lib/word-array.class.cjs";
2
+ export declare class Hex {
3
+ /**
4
+ * Converts a hex string to a word array.
5
+ *
6
+ * @param hexStr The hex string.
7
+ *
8
+ * @return The word array.
9
+ *
10
+ * @example
11
+ *
12
+ * let wordArray = Hex.parse(hexString);
13
+ */
14
+ static parse(hexStr: string): WordArray;
15
+ /**
16
+ * Converts a word array to a hex string.
17
+ *
18
+ * @param wordArray The word array.
19
+ *
20
+ * @return The hex string.
21
+ *
22
+ * @example
23
+ *
24
+ * let hexString = Hex.stringify(wordArray);
25
+ */
26
+ static stringify(wordArray: WordArray): string;
27
+ }
@@ -0,0 +1,6 @@
1
+ export * from "./base64.class.cjs";
2
+ export * from "./encoder.model.cjs";
3
+ export * from "./hex.class.cjs";
4
+ export * from "./latin1.class.cjs";
5
+ export * from "./utf16.class.cjs";
6
+ export * from "./utf8.class.cjs";
@@ -0,0 +1,27 @@
1
+ import { WordArray } from "../lib/word-array.class.cjs";
2
+ export declare class Latin1 {
3
+ /**
4
+ * Converts a Latin1 string to a word array.
5
+ *
6
+ * @param latin1Str The Latin1 string.
7
+ *
8
+ * @return The word array.
9
+ *
10
+ * @example
11
+ *
12
+ * let wordArray = Latin1.parse(latin1String);
13
+ */
14
+ static parse(latin1Str: string): WordArray;
15
+ /**
16
+ * Converts a word array to a Latin1 string.
17
+ *
18
+ * @param wordArray The word array.
19
+ *
20
+ * @return The Latin1 string.
21
+ *
22
+ * @example
23
+ *
24
+ * let latin1String = Latin1.stringify(wordArray);
25
+ */
26
+ static stringify(wordArray: WordArray): string;
27
+ }
@@ -0,0 +1,28 @@
1
+ import { WordArray } from "../lib/word-array.class.cjs";
2
+ import { AbstractEncoder } from "./encoder.model.cjs";
3
+ export declare class Utf16 implements AbstractEncoder {
4
+ /**
5
+ * Converts a UTF-16 BE string to a word array.
6
+ *
7
+ * @param utf16Str The UTF-16 BE string.
8
+ *
9
+ * @return The word array.
10
+ *
11
+ * @example
12
+ *
13
+ * const wordArray = Utf16.parse(utf8String);
14
+ */
15
+ static parse(utf16Str: string): WordArray;
16
+ /**
17
+ * Converts a word array to a UTF-16 BE string.
18
+ *
19
+ * @param wordArray The word array.
20
+ *
21
+ * @return The UTF-16 BE string.
22
+ *
23
+ * @example
24
+ *
25
+ * const utf16String = Utf16.stringify(wordArray);
26
+ */
27
+ static stringify(wordArray: WordArray): string;
28
+ }
@@ -0,0 +1,28 @@
1
+ import { WordArray } from "../lib/word-array.class.cjs";
2
+ import { AbstractEncoder } from "./encoder.model.cjs";
3
+ export declare class Utf8 implements AbstractEncoder {
4
+ /**
5
+ * Converts a UTF-8 string to a word array.
6
+ *
7
+ * @param utf8Str The UTF-8 string.
8
+ *
9
+ * @return The word array.
10
+ *
11
+ * @example
12
+ *
13
+ * let wordArray = Utf8.parse(utf8String);
14
+ */
15
+ static parse(utf8Str: string): WordArray;
16
+ /**
17
+ * Converts a word array to a UTF-8 string.
18
+ *
19
+ * @param wordArray The word array.
20
+ *
21
+ * @return The UTF-8 string.
22
+ *
23
+ * @example
24
+ *
25
+ * const utf8String = Utf8.stringify(wordArray);
26
+ */
27
+ static stringify(wordArray: WordArray): string;
28
+ }
@@ -0,0 +1,5 @@
1
+ import { CipherParams } from '../lib/cipher-params.class.cjs';
2
+ export interface Formatter {
3
+ stringify: (cipherParams: CipherParams) => string;
4
+ parse: (paramsStr: string) => CipherParams;
5
+ }
@@ -0,0 +1,27 @@
1
+ import { CipherParams } from "../lib/cipher-params.class.cjs";
2
+ export declare class OpenSSL {
3
+ /**
4
+ * Converts an OpenSSL-compatible string to a cipher params object.
5
+ *
6
+ * @param openSSLStr The OpenSSL-compatible string.
7
+ *
8
+ * @return The cipher params object.
9
+ *
10
+ * @example
11
+ *
12
+ * let cipherParams = OpenSSLFormatter.parse(openSSLString);
13
+ */
14
+ static parse(openSSLStr: string): CipherParams;
15
+ /**
16
+ * Converts a cipher params object to an OpenSSL-compatible string.
17
+ *
18
+ * @param cipherParams The cipher params object.
19
+ *
20
+ * @return The OpenSSL-compatible string.
21
+ *
22
+ * @example
23
+ *
24
+ * let openSSLString = OpenSSLFormatter.stringify(cipherParams);
25
+ */
26
+ static stringify(cipherParams: CipherParams): string;
27
+ }
@@ -0,0 +1,2 @@
1
+ import { CipherHelper } from "../lib/cipher-helper.class.cjs";
2
+ export declare const aesHelper: CipherHelper;
@@ -0,0 +1,2 @@
1
+ import { CipherHelper } from "../lib/cipher-helper.class.cjs";
2
+ export declare const desHelper: CipherHelper;
@@ -0,0 +1,7 @@
1
+ export { aesHelper } from "./aes.helper.cjs";
2
+ export { desHelper } from "./des.helper.cjs";
3
+ export { md5Helper } from "./md5.helper.cjs";
4
+ export { sha1Helper } from "./sha1.helper.cjs";
5
+ export { sha256Helper } from "./sha256.helper.cjs";
6
+ export { sha512Helper } from "./sha512.helper.cjs";
7
+ export { tripleDesHelper } from "./triple-des.helper.cjs";
@@ -0,0 +1,2 @@
1
+ import { HasherHelper } from "../lib/hasher-helper.type.cjs";
2
+ export declare const md5Helper: HasherHelper;
@@ -0,0 +1,2 @@
1
+ import { HasherHelper } from "../lib/hasher-helper.type.cjs";
2
+ export declare const sha1Helper: HasherHelper;
@@ -0,0 +1,2 @@
1
+ import { HasherHelper } from "../lib/hasher-helper.type.cjs";
2
+ export declare const sha256Helper: HasherHelper;
@@ -0,0 +1,2 @@
1
+ import { HasherHelper } from "../lib/hasher-helper.type.cjs";
2
+ export declare const sha512Helper: HasherHelper;
@@ -0,0 +1,2 @@
1
+ import { CipherHelper } from "../lib/cipher-helper.class.cjs";
2
+ export declare const tripleDesHelper: CipherHelper;
@@ -0,0 +1 @@
1
+ "use strict";var Bt=Object.defineProperty;var rs=Object.getOwnPropertyDescriptor;var os=Object.getOwnPropertyNames;var is=Object.prototype.hasOwnProperty;var hs=(n,t)=>{for(var s in t)Bt(n,s,{get:t[s],enumerable:!0})},ns=(n,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of os(t))!is.call(n,e)&&e!==s&&Bt(n,e,{get:()=>t[e],enumerable:!(r=rs(t,e))||r.enumerable});return n};var cs=n=>ns(Bt({},"__esModule",{value:!0}),n);var _s={};hs(_s,{AES:()=>P,Base64:()=>K,BlockCipher:()=>u,CBC:()=>G,CTR:()=>J,CipherParams:()=>R,DES:()=>z,ECB:()=>Q,EVPKDF:()=>rt,Hasher:()=>g,Hex:()=>tt,Latin1:()=>N,MD5:()=>X,NoPadding:()=>at,PBKDF2:()=>mt,PKCS7:()=>U,PasswordBasedCipher:()=>D,SHA1:()=>ot,SHA256:()=>T,SHA512:()=>it,SerializableCipher:()=>I,TripleDES:()=>A,Utf16:()=>wt,Utf8:()=>L,WordArray:()=>f,X64Word:()=>a,X64WordArray:()=>V,aesHelper:()=>bt,desHelper:()=>Ct,md5Helper:()=>vt,sha1Helper:()=>It,sha256Helper:()=>Et,sha512Helper:()=>Mt,tripleDesHelper:()=>Rt});module.exports=cs(_s);var tt=class{static parse(t){let s=t.length,r=[];for(let e=0;e<s;e+=2)r[e>>>3]|=parseInt(t.substr(e,2),16)<<24-e%8*4;return new f(r,s/2)}static stringify(t){let s=[];for(let r=0;r<t.sigBytes;r++){let e=t.words[r>>>2]>>>24-r%4*8&255;s.push((e>>>4).toString(16)),s.push((e&15).toString(16))}return s.join("")}};var f=class n{constructor(t,s){this.words=t||[],s!==void 0?this.sigBytes=s:this.sigBytes=this.words.length*4}static random(t){let s=[],r=function(e){let o=987654321,i=4294967295;return function(){o=36969*(o&65535)+(o>>16)&i,e=18e3*(e&65535)+(e>>16)&i;let h=(o<<16)+e&i;return h/=4294967296,h+=.5,h*(Math.random()>.5?1:-1)}};for(let e=0,o;e<t;e+=4){let i=r((o||Math.random())*4294967296);o=i()*987654071,s.push(i()*4294967296|0)}return new n(s,t)}clamp(){this.words[this.sigBytes>>>2]&=4294967295<<32-this.sigBytes%4*8,this.words.length=Math.ceil(this.sigBytes/4)}clone(){return new n(this.words.slice(0),this.sigBytes)}concat(t){if(this.clamp(),this.sigBytes%4)for(let s=0;s<t.sigBytes;s++){let r=t.words[s>>>2]>>>24-s%4*8&255;this.words[this.sigBytes+s>>>2]|=r<<24-(this.sigBytes+s)%4*8}else for(let s=0;s<t.sigBytes;s+=4)this.words[this.sigBytes+s>>>2]=t.words[s>>>2];return this.sigBytes+=t.sigBytes,this}toString(t){return(t||tt).stringify(this)}};var N=class{static parse(t){let s=t.length,r=[];for(let e=0;e<s;e++)r[e>>>2]|=(t.charCodeAt(e)&255)<<24-e%4*8;return new f(r,s)}static stringify(t){let s=[];for(let r=0;r<t.sigBytes;r++){let e=t.words[r>>>2]>>>24-r%4*8&255;s.push(String.fromCharCode(e))}return s.join("")}};var L=class{static parse(t){return N.parse(unescape(encodeURIComponent(t)))}static stringify(t){try{return decodeURIComponent(escape(N.stringify(t)))}catch(s){throw console.error("Malformed UTF-8 data",s),new Error("Malformed UTF-8 data")}}};var st=class{constructor(t){this._minBufferSize=0,this.cfg=Object.assign({blockSize:1},t),this._data=new f,this._nDataBytes=0}clone(){let t=this.constructor();for(let s in this)Object.prototype.hasOwnProperty.call(this,s)&&(t[s]=this[s]);return t._data=this._data.clone(),t}reset(){this._data=new f,this._nDataBytes=0}_append(t){typeof t=="string"&&(t=L.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes}_process(t){if(!this.cfg.blockSize)throw new Error("missing blockSize in config");let s=this.cfg.blockSize*4,r=this._data.sigBytes/s;t?r=Math.ceil(r):r=Math.max((r|0)-this._minBufferSize,0);let e=r*this.cfg.blockSize,o=Math.min(e*4,this._data.sigBytes),i;if(e){for(let h=0;h<e;h+=this.cfg.blockSize)this._doProcessBlock(this._data.words,h);i=this._data.words.splice(0,e),this._data.sigBytes-=o}return new f(i,o)}};var R=class{constructor(t){this.ciphertext=t.ciphertext,this.key=t.key,this.iv=t.iv,this.salt=t.salt,this.algorithm=t.algorithm,this.mode=t.mode,this.padding=t.padding,this.blockSize=t.blockSize,this.formatter=t.formatter}extend(t){return t.ciphertext!==void 0&&(this.ciphertext=t.ciphertext),t.key!==void 0&&(this.key=t.key),t.iv!==void 0&&(this.iv=t.iv),t.salt!==void 0&&(this.salt=t.salt),t.algorithm!==void 0&&(this.algorithm=t.algorithm),t.mode!==void 0&&(this.mode=t.mode),t.padding!==void 0&&(this.padding=t.padding),t.blockSize!==void 0&&(this.blockSize=t.blockSize),t.formatter!==void 0&&(this.formatter=t.formatter),this}toString(t){if(t)return t.stringify(this);if(this.formatter)return this.formatter.stringify(this);throw new Error("cipher needs a formatter to be able to convert the result into a string")}};var K=class{static parse(t){let s=t.length;if(this._reverseMap===void 0){this._reverseMap=[];for(let e=0;e<this._map.length;e++)this._reverseMap[this._map.charCodeAt(e)]=e}let r=this._map.charAt(64);if(r){let e=t.indexOf(r);e!==-1&&(s=e)}return this.parseLoop(t,s,this._reverseMap)}static parseLoop(t,s,r){let e=[],o=0;for(let i=0;i<s;i++)if(i%4){let h=r[t.charCodeAt(i-1)]<<i%4*2,c=r[t.charCodeAt(i)]>>>6-i%4*2;e[o>>>2]|=(h|c)<<24-o%4*8,o++}return new f(e,o)}static stringify(t){t.clamp();let s=[];for(let e=0;e<t.sigBytes;e+=3){let o=t.words[e>>>2]>>>24-e%4*8&255,i=t.words[e+1>>>2]>>>24-(e+1)%4*8&255,h=t.words[e+2>>>2]>>>24-(e+2)%4*8&255,c=o<<16|i<<8|h;for(let d=0;d<4&&e+d*.75<t.sigBytes;d++)s.push(this._map.charAt(c>>>6*(3-d)&63))}let r=this._map.charAt(64);if(r)for(;s.length%4;)s.push(r);return s.join("")}};K._map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";K._reverseMap=void 0;var et=class{static parse(t){let s=K.parse(t),r;return s.words[0]===1398893684&&s.words[1]===1701076831&&(r=new f(s.words.slice(2,4)),s.words.splice(0,4),s.sigBytes-=16),new R({ciphertext:s,salt:r})}static stringify(t){if(!t.ciphertext)throw new Error("missing ciphertext in params");let s=t.ciphertext,r=t.salt,e;if(r){if(typeof r=="string")throw new Error("salt is expected to be a WordArray");e=new f([1398893684,1701076831]).concat(r).concat(s)}else e=s;return e.toString(K)}};var I=class{static decrypt(t,s,r,e){let o=Object.assign({},this.cfg,e);if(!o.format)throw new Error("could not determine format");if(s=this._parse(s,o.format),!s.ciphertext)throw new Error("could not determine ciphertext");return t.createDecryptor(r,o).finalize(s.ciphertext)}static encrypt(t,s,r,e){let o=Object.assign({},this.cfg,e),i=t.createEncryptor(r,o),h=i.finalize(s);return new R({ciphertext:h,key:r,iv:i.cfg.iv,algorithm:t,mode:i.cfg.mode,padding:i.cfg.padding,blockSize:i.cfg.blockSize,formatter:o.format})}static _parse(t,s){return typeof t=="string"?s.parse(t):t}};I.cfg={blockSize:4,iv:new f([]),format:et};var g=class extends st{constructor(t){super(Object.assign({blockSize:512/32},t)),this.reset()}static _createHelper(t){function s(r,e){return new t(e).finalize(r)}return s}finalize(t){return t&&this._append(t),this._doFinalize()}update(t){return this._append(t),this._process(),this}};var l=[];for(let n=0;n<64;n++)l[n]=Math.abs(Math.sin(n+1))*4294967296|0;var X=class n extends g{get hash(){return this._hash}static FF(t,s,r,e,o,i,h){let c=t+(s&r|~s&e)+o+h;return(c<<i|c>>>32-i)+s}static GG(t,s,r,e,o,i,h){let c=t+(s&e|r&~e)+o+h;return(c<<i|c>>>32-i)+s}static HH(t,s,r,e,o,i,h){let c=t+(s^r^e)+o+h;return(c<<i|c>>>32-i)+s}static II(t,s,r,e,o,i,h){let c=t+(r^(s|~e))+o+h;return(c<<i|c>>>32-i)+s}reset(){super.reset(),this._hash=new f([1732584193,4023233417,2562383102,271733878])}_doFinalize(){let t=this._nDataBytes*8,s=this._data.sigBytes*8;this._data.words[s>>>5]|=128<<24-s%32;let r=Math.floor(t/4294967296),e=t;this._data.words[(s+64>>>9<<4)+15]=(r<<8|r>>>24)&16711935|(r<<24|r>>>8)&4278255360,this._data.words[(s+64>>>9<<4)+14]=(e<<8|e>>>24)&16711935|(e<<24|e>>>8)&4278255360,this._data.sigBytes=(this._data.words.length+1)*4,this._process();for(let o=0;o<4;o++)this._hash.words[o]=(this._hash.words[o]<<8|this._hash.words[o]>>>24)&16711935|(this._hash.words[o]<<24|this._hash.words[o]>>>8)&4278255360;return this._hash}_doProcessBlock(t,s){for(let c=0;c<16;c++){let d=s+c,w=t[d];t[d]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360}let r=Array.from({length:16});for(let c=0;c<16;c++)r[c]=t[s+c];let e=this._hash.words[0],o=this._hash.words[1],i=this._hash.words[2],h=this._hash.words[3];e=n.FF(e,o,i,h,r[0],7,l[0]),h=n.FF(h,e,o,i,r[1],12,l[1]),i=n.FF(i,h,e,o,r[2],17,l[2]),o=n.FF(o,i,h,e,r[3],22,l[3]),e=n.FF(e,o,i,h,r[4],7,l[4]),h=n.FF(h,e,o,i,r[5],12,l[5]),i=n.FF(i,h,e,o,r[6],17,l[6]),o=n.FF(o,i,h,e,r[7],22,l[7]),e=n.FF(e,o,i,h,r[8],7,l[8]),h=n.FF(h,e,o,i,r[9],12,l[9]),i=n.FF(i,h,e,o,r[10],17,l[10]),o=n.FF(o,i,h,e,r[11],22,l[11]),e=n.FF(e,o,i,h,r[12],7,l[12]),h=n.FF(h,e,o,i,r[13],12,l[13]),i=n.FF(i,h,e,o,r[14],17,l[14]),o=n.FF(o,i,h,e,r[15],22,l[15]),e=n.GG(e,o,i,h,r[1],5,l[16]),h=n.GG(h,e,o,i,r[6],9,l[17]),i=n.GG(i,h,e,o,r[11],14,l[18]),o=n.GG(o,i,h,e,r[0],20,l[19]),e=n.GG(e,o,i,h,r[5],5,l[20]),h=n.GG(h,e,o,i,r[10],9,l[21]),i=n.GG(i,h,e,o,r[15],14,l[22]),o=n.GG(o,i,h,e,r[4],20,l[23]),e=n.GG(e,o,i,h,r[9],5,l[24]),h=n.GG(h,e,o,i,r[14],9,l[25]),i=n.GG(i,h,e,o,r[3],14,l[26]),o=n.GG(o,i,h,e,r[8],20,l[27]),e=n.GG(e,o,i,h,r[13],5,l[28]),h=n.GG(h,e,o,i,r[2],9,l[29]),i=n.GG(i,h,e,o,r[7],14,l[30]),o=n.GG(o,i,h,e,r[12],20,l[31]),e=n.HH(e,o,i,h,r[5],4,l[32]),h=n.HH(h,e,o,i,r[8],11,l[33]),i=n.HH(i,h,e,o,r[11],16,l[34]),o=n.HH(o,i,h,e,r[14],23,l[35]),e=n.HH(e,o,i,h,r[1],4,l[36]),h=n.HH(h,e,o,i,r[4],11,l[37]),i=n.HH(i,h,e,o,r[7],16,l[38]),o=n.HH(o,i,h,e,r[10],23,l[39]),e=n.HH(e,o,i,h,r[13],4,l[40]),h=n.HH(h,e,o,i,r[0],11,l[41]),i=n.HH(i,h,e,o,r[3],16,l[42]),o=n.HH(o,i,h,e,r[6],23,l[43]),e=n.HH(e,o,i,h,r[9],4,l[44]),h=n.HH(h,e,o,i,r[12],11,l[45]),i=n.HH(i,h,e,o,r[15],16,l[46]),o=n.HH(o,i,h,e,r[2],23,l[47]),e=n.II(e,o,i,h,r[0],6,l[48]),h=n.II(h,e,o,i,r[7],10,l[49]),i=n.II(i,h,e,o,r[14],15,l[50]),o=n.II(o,i,h,e,r[5],21,l[51]),e=n.II(e,o,i,h,r[12],6,l[52]),h=n.II(h,e,o,i,r[3],10,l[53]),i=n.II(i,h,e,o,r[10],15,l[54]),o=n.II(o,i,h,e,r[1],21,l[55]),e=n.II(e,o,i,h,r[8],6,l[56]),h=n.II(h,e,o,i,r[15],10,l[57]),i=n.II(i,h,e,o,r[6],15,l[58]),o=n.II(o,i,h,e,r[13],21,l[59]),e=n.II(e,o,i,h,r[4],6,l[60]),h=n.II(h,e,o,i,r[11],10,l[61]),i=n.II(i,h,e,o,r[2],15,l[62]),o=n.II(o,i,h,e,r[9],21,l[63]),this._hash.words[0]=this._hash.words[0]+e|0,this._hash.words[1]=this._hash.words[1]+o|0,this._hash.words[2]=this._hash.words[2]+i|0,this._hash.words[3]=this._hash.words[3]+h|0}};var rt=class n{constructor(t){this.cfg=Object.assign({keySize:128/32,hasher:X,iterations:1},t)}static execute(t,s,r){return new n(r).compute(t,s)}compute(t,s){let r=new this.cfg.hasher,e=new f,o;for(;e.words.length<this.cfg.keySize;){o&&r.update(o),o=r.update(t).finalize(s),r.reset();for(let i=1;i<this.cfg.iterations;i++)o=r.finalize(o),r.reset();e.concat(o)}return e.sigBytes=this.cfg.keySize*4,e}};var lt=class{static execute(t,s,r,e){e||(e=f.random(64/8));let o=new rt({keySize:s+r}).compute(t,e),i=new f(o.words.slice(s),r*4);return o.sigBytes=s*4,new R({key:o,iv:i,salt:e})}};var D=class{static decrypt(t,s,r,e){let o=Object.assign({},this.cfg,e);if(o.format===void 0)throw new Error("missing format in config");if(s=this._parse(s,o.format),o.kdf===void 0)throw new Error("the key derivation function must be set");let i=o.kdf.execute(r,t.keySize,t.ivSize,s.salt);return i.iv!==void 0&&(o.iv=i.iv),I.decrypt.call(this,t,s,i.key,o)}static encrypt(t,s,r,e){let o=Object.assign({},this.cfg,e);if(o.kdf===void 0)throw new Error("missing kdf in config");let i=o.kdf.execute(r,t.keySize,t.ivSize);return i.iv!==void 0&&(o.iv=i.iv),I.encrypt.call(this,t,s,i.key,o).extend(i)}static _parse(t,s){return typeof t=="string"?s.parse(t):t}};D.cfg={blockSize:4,iv:new f([]),format:et,kdf:lt};var ft=class{constructor(t){this._cipher=t}decrypt(t,s,r){return typeof s=="string"?D.decrypt(this._cipher,t,s,r):I.decrypt(this._cipher,t,s,r)}encrypt(t,s,r){return typeof s=="string"?D.encrypt(this._cipher,t,s,r):I.encrypt(this._cipher,t,s,r)}};var j=class extends st{constructor(t,s,r){super(Object.assign({blockSize:1},r)),this._xformMode=t,this._key=s,this.reset()}static _createHelper(t){return new ft(t)}static createDecryptor(t,s){let r=this;return new r(this._DEC_XFORM_MODE,t,s)}static createEncryptor(t,s){return new this(this._ENC_XFORM_MODE,t,s)}finalize(t){return t&&this._append(t),this._doFinalize()}process(t){return this._append(t),this._process()}};j.ivSize=4;j.keySize=4;j._DEC_XFORM_MODE=2;j._ENC_XFORM_MODE=1;var B=class{constructor(t,s){this.init(t,s)}init(t,s){this._cipher=t,this._iv=s}};var W=class{static createDecryptor(t,s){let r=this.Decryptor;return new r(t,s)}static createEncryptor(t,s){let r=this.Encryptor;return new r(t,s)}};W.Decryptor=B;W.Encryptor=B;var dt=class extends B{get prevBlock(){return this._prevBlock}processBlock(t,s){if(this._cipher.cfg.blockSize===void 0)throw new Error("missing blockSize in cipher config");this.xorBlock(t,s,this._cipher.cfg.blockSize),this._cipher.encryptBlock(t,s),this._prevBlock=t.slice(s,s+this._cipher.cfg.blockSize)}xorBlock(t,s,r){let e;this._iv?(e=this._iv,this._iv=void 0):e=this._prevBlock;for(let o=0;o<r;o++)t[s+o]^=e[o]}};var pt=class extends B{get prevBlock(){return this._prevBlock}processBlock(t,s){if(this._cipher.cfg.blockSize===void 0)throw new Error("missing blockSize in cipher config");let r=t.slice(s,s+this._cipher.cfg.blockSize);this._cipher.decryptBlock(t,s),this.xorBlock(t,s,this._cipher.cfg.blockSize),this._prevBlock=r}xorBlock(t,s,r){let e;this._iv?(e=this._iv,this._iv=void 0):e=this._prevBlock;for(let o=0;o<r;o++)t[s+o]^=e[o]}};var G=class extends W{};G.Decryptor=pt;G.Encryptor=dt;var U=class{static pad(t,s){let r=s*4,e=r-t.sigBytes%r,o=e<<24|e<<16|e<<8|e,i=[];for(let c=0;c<e;c+=4)i.push(o);let h=new f(i,e);t.concat(h)}static unpad(t){let s=t.words[t.sigBytes-1>>>2]&255;t.sigBytes-=s}};var u=class extends j{constructor(t,s,r){super(t,s,Object.assign({blockSize:4,mode:G,padding:U},r))}reset(){if(super.reset(),this.cfg.mode===void 0)throw new Error("missing mode in config");let t;this._xformMode===this.constructor._ENC_XFORM_MODE?t=this.cfg.mode.createEncryptor:(t=this.cfg.mode.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator===t?this._mode.init(this,this.cfg.iv&&this.cfg.iv.words):(this._mode=t.call(this.cfg.mode,this,this.cfg.iv&&this.cfg.iv.words),this._mode.__creator=t)}_doFinalize(){if(this.cfg.padding===void 0)throw new Error("missing padding in config");let t;if(this._xformMode===this.constructor._ENC_XFORM_MODE){if(this.cfg.blockSize===void 0)throw new Error("missing blockSize in config");this.cfg.padding.pad(this._data,this.cfg.blockSize),t=this._process(!0)}else t=this._process(!0),this.cfg.padding.unpad(t);return t}_doProcessBlock(t,s){this._mode.processBlock(t,s)}};var a=class n{constructor(t,s){this.high=t,this.low=s}add(t){let s=this.low+t.low|0,r=s>>>0<this.low>>>0?1:0,e=this.high+t.high+r|0;return new n(e,s)}and(t){return new n(this.high&t.high,this.low&t.low)}not(){return new n(~this.high,~this.low)}or(t){return new n(this.high|t.high,this.low|t.low)}rotL(t){return this.shiftL(t).or(this.shiftR(64-t))}rotR(t){return this.shiftR(t).or(this.shiftL(64-t))}shiftL(t){return t<32?new n(this.high<<t|this.low>>>32-t,this.low<<t):new n(this.low<<t-32,0)}shiftR(t){return t<32?new n(this.high>>>t,this.low>>>t|this.high<<32-t):new n(0,this.high>>>t-32)}xor(t){return new n(this.high^t.high,this.low^t.low)}};var V=class n{constructor(t=[],s){this.words=t,this.sigBytes=s!==void 0?s:t.length*8}static create(t=[],s){return new n(t,s)}clone(){let t=this.words.map(s=>new a(s.high,s.low));return new n(t,this.sigBytes)}toX32(){let t=[];for(let s of this.words)t.push(s.high,s.low);return new f(t,this.sigBytes)}};var S=[],Xt=[],jt=[],Tt=[],Nt=[],Ut=[],kt=[],St=[],Ft=[],Ht=[];(function(){let n=[];for(let r=0;r<256;r++)r<128?n[r]=r<<1:n[r]=r<<1^283;let t=0,s=0;for(let r=0;r<256;r++){let e=s^s<<1^s<<2^s<<3^s<<4;e=e>>>8^e&255^99,S[t]=e,Xt[e]=t;let o=n[t],i=n[o],h=n[i],c=n[e]*257^e*16843008;jt[t]=c<<24|c>>>8,Tt[t]=c<<16|c>>>16,Nt[t]=c<<8|c>>>24,Ut[t]=c,c=h*16843009^i*65537^o*257^t*16843008,kt[e]=c<<24|c>>>8,St[e]=c<<16|c>>>16,Ft[e]=c<<8|c>>>24,Ht[e]=c,t?(t=o^n[n[n[h^o]]],s^=n[n[s]]):t=s=1}})();var as=[0,1,2,4,8,16,32,64,128,27,54],P=class extends u{constructor(t,s,r){super(t,s,r),super.reset()}decryptBlock(t,s){let r=t[s+1];t[s+1]=t[s+3],t[s+3]=r,this._doCryptBlock(t,s,this._invKeySchedule,kt,St,Ft,Ht,Xt),r=t[s+1],t[s+1]=t[s+3],t[s+3]=r}encryptBlock(t,s){this._doCryptBlock(t,s,this._keySchedule,jt,Tt,Nt,Ut,S)}reset(){if(super.reset(),this._nRounds&&this._keyPriorReset===this._key)return;let t=this._keyPriorReset=this._key,s=t.words,r=t.sigBytes/4,o=((this._nRounds=r+6)+1)*4,i=this._keySchedule=[];for(let h=0;h<o;h++)if(h<r)i[h]=s[h];else{let c=i[h-1];h%r?r>6&&h%r===4&&(c=S[c>>>24]<<24|S[c>>>16&255]<<16|S[c>>>8&255]<<8|S[c&255]):(c=c<<8|c>>>24,c=S[c>>>24]<<24|S[c>>>16&255]<<16|S[c>>>8&255]<<8|S[c&255],c^=as[h/r|0]<<24),i[h]=i[h-r]^c}this._invKeySchedule=[];for(let h=0;h<o;h++){let c=o-h,d;h%4?d=i[c]:d=i[c-4],h<4||c<=4?this._invKeySchedule[h]=d:this._invKeySchedule[h]=kt[S[d>>>24]]^St[S[d>>>16&255]]^Ft[S[d>>>8&255]]^Ht[S[d&255]]}}_doCryptBlock(t,s,r,e,o,i,h,c){let d=t[s]^r[0],w=t[s+1]^r[1],p=t[s+2]^r[2],_=t[s+3]^r[3],y=4;for(let k=1;k<this._nRounds;k++){let m=e[d>>>24]^o[w>>>16&255]^i[p>>>8&255]^h[_&255]^r[y++],x=e[w>>>24]^o[p>>>16&255]^i[_>>>8&255]^h[d&255]^r[y++],v=e[p>>>24]^o[_>>>16&255]^i[d>>>8&255]^h[w&255]^r[y++],ut=e[_>>>24]^o[d>>>16&255]^i[w>>>8&255]^h[p&255]^r[y++];d=m,w=x,p=v,_=ut}let F=(c[d>>>24]<<24|c[w>>>16&255]<<16|c[p>>>8&255]<<8|c[_&255])^r[y++],M=(c[w>>>24]<<24|c[p>>>16&255]<<16|c[_>>>8&255]<<8|c[d&255])^r[y++],b=(c[p>>>24]<<24|c[_>>>16&255]<<16|c[d>>>8&255]<<8|c[w&255])^r[y++],C=(c[_>>>24]<<24|c[d>>>16&255]<<16|c[w>>>8&255]<<8|c[p&255])^r[y++];t[s]=F,t[s+1]=M,t[s+2]=b,t[s+3]=C}};P.keySize=256/32;var ls=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],Vt=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],fs=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],ds=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],ps=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],z=class extends u{constructor(t,s,r){super(t,s,r),this._invSubKeys=[],this._lBlock=0,this._rBlock=0,this._subKeys=[],this.reset()}decryptBlock(t,s){this._doCryptBlock(t,s,this._invSubKeys)}encryptBlock(t,s){this._doCryptBlock(t,s,this._subKeys)}reset(){super.reset();let t=[];for(let s=0;s<56;s++){let r=ls[s]-1;t[s]=this._key.words[r>>>5]>>>31-r%32&1}this._subKeys=[];for(let s=0;s<16;s++){this._subKeys[s]=[];let r=fs[s];for(let e=0;e<24;e++)this._subKeys[s][e/6|0]|=t[(Vt[e]-1+r)%28]<<31-e%6,this._subKeys[s][4+(e/6|0)]|=t[28+(Vt[e+24]-1+r)%28]<<31-e%6;this._subKeys[s][0]=this._subKeys[s][0]<<1|this._subKeys[s][0]>>>31;for(let e=1;e<7;e++)this._subKeys[s][e]=this._subKeys[s][e]>>>(e-1)*4+3;this._subKeys[s][7]=this._subKeys[s][7]<<5|this._subKeys[s][7]>>>27}this._invSubKeys=[];for(let s=0;s<16;s++)this._invSubKeys[s]=this._subKeys[15-s]}_doCryptBlock(t,s,r){this._lBlock=t[s],this._rBlock=t[s+1],this._exchangeLR(4,252645135),this._exchangeLR(16,65535),this._exchangeRL(2,858993459),this._exchangeRL(8,16711935),this._exchangeLR(1,1431655765);for(let e=0;e<16;e++){let o=r[e],i=0;for(let h=0;h<8;h++)i|=ds[h][((this._rBlock^o[h])&ps[h])>>>0];[this._lBlock,this._rBlock]=[this._rBlock,this._lBlock^i]}[this._lBlock,this._rBlock]=[this._rBlock,this._lBlock],this._exchangeLR(1,1431655765),this._exchangeRL(8,16711935),this._exchangeRL(2,858993459),this._exchangeLR(16,65535),this._exchangeLR(4,252645135),t[s]=this._lBlock,t[s+1]=this._rBlock}_exchangeLR(t,s){let r=(this._lBlock>>>t^this._rBlock)&s;this._rBlock^=r,this._lBlock^=r<<t}_exchangeRL(t,s){let r=(this._rBlock>>>t^this._lBlock)&s;this._lBlock^=r,this._rBlock^=r<<t}};z.blockSize=64/32;z.ivSize=64/32;z.keySize=64/32;var A=class extends u{constructor(t,s,r){super(t,s,r),this.reset()}decryptBlock(t,s){this._des3.decryptBlock(t,s),this._des2.encryptBlock(t,s),this._des1.decryptBlock(t,s)}encryptBlock(t,s){this._des1.encryptBlock(t,s),this._des2.decryptBlock(t,s),this._des3.encryptBlock(t,s)}reset(){if(super.reset(),this._key.words.length!==2&&this._key.words.length!==4&&this._key.words.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");let t=this._key.words.slice(0,2),s=this._key.words.length<4?this._key.words.slice(0,2):this._key.words.slice(2,4),r=this._key.words.length<6?this._key.words.slice(0,2):this._key.words.slice(4,6);this._des1=z.createEncryptor(new f(t)),this._des2=z.createEncryptor(new f(s)),this._des3=z.createEncryptor(new f(r))}};A.blockSize=192/32;A.ivSize=64/32;A.keySize=64/32;var ws=[1732584193,4023233417,2562383102,271733878,3285377520],q=new Array(80),ot=class extends g{get hash(){return this._hash}reset(){super.reset(),this._hash=new f(ws.slice(0))}_doFinalize(){let t=this._nDataBytes*8,s=this._data.sigBytes*8;return this._data.words[s>>>5]|=128<<24-s%32,this._data.words[(s+64>>>9<<4)+14]=Math.floor(t/4294967296),this._data.words[(s+64>>>9<<4)+15]=t,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}_doProcessBlock(t,s){let r=this._hash.words[0],e=this._hash.words[1],o=this._hash.words[2],i=this._hash.words[3],h=this._hash.words[4];for(let c=0;c<80;c++){if(c<16)q[c]=t[s+c]|0;else{let _=q[c-3]^q[c-8]^q[c-14]^q[c-16];q[c]=_<<1|_>>>31}let d,w;c<20?(d=e&o|~e&i,w=1518500249):c<40?(d=e^o^i,w=1859775393):c<60?(d=e&o|e&i|o&i,w=2400959708):(d=e^o^i,w=3395469782);let p=(r<<5|r>>>27)+d+h+w+q[c];h=i,i=o,o=e<<30|e>>>2,e=r,r=p|0}this._hash.words[0]=this._hash.words[0]+r|0,this._hash.words[1]=this._hash.words[1]+e|0,this._hash.words[2]=this._hash.words[2]+o|0,this._hash.words[3]=this._hash.words[3]+i|0,this._hash.words[4]=this._hash.words[4]+h|0}};var Pt=[],qt=[];(function(){function n(e){let o=Math.sqrt(e);for(let i=2;i<=o;i++)if(!(e%i))return!1;return!0}function t(e){return(e-(e|0))*4294967296|0}let s=2,r=0;for(;r<64;)n(s)&&(r<8&&(Pt[r]=t(Math.pow(s,1/2))),qt[r]=t(Math.pow(s,1/3)),r++),s++})();var Z=[],T=class extends g{constructor(){super()}reset(){super.reset(),this._hash=new f(Pt.slice(0))}_doFinalize(){let t=this._nDataBytes*8,s=this._data.sigBytes*8;return this._data.words[s>>>5]|=128<<24-s%32,this._data.words[(s+64>>>9<<4)+14]=Math.floor(t/4294967296),this._data.words[(s+64>>>9<<4)+15]=t,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}_doProcessBlock(t,s){let r=this._hash.words[0],e=this._hash.words[1],o=this._hash.words[2],i=this._hash.words[3],h=this._hash.words[4],c=this._hash.words[5],d=this._hash.words[6],w=this._hash.words[7];for(let p=0;p<64;p++){if(p<16)Z[p]=t[s+p]|0;else{let k=Z[p-15],m=(k<<25|k>>>7)^(k<<14|k>>>18)^k>>>3,x=Z[p-2],v=(x<<15|x>>>17)^(x<<13|x>>>19)^x>>>10;Z[p]=m+Z[p-7]+v+Z[p-16]}let _=h&c^~h&d,y=r&e^r&o^e&o,F=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),M=(h<<26|h>>>6)^(h<<21|h>>>11)^(h<<7|h>>>25),b=w+M+_+qt[p]+Z[p],C=F+y;w=d,d=c,c=h,h=i+b|0,i=o,o=e,e=r,r=b+C|0}this._hash.words[0]=this._hash.words[0]+r|0,this._hash.words[1]=this._hash.words[1]+e|0,this._hash.words[2]=this._hash.words[2]+o|0,this._hash.words[3]=this._hash.words[3]+i|0,this._hash.words[4]=this._hash.words[4]+h|0,this._hash.words[5]=this._hash.words[5]+c|0,this._hash.words[6]=this._hash.words[6]+d|0,this._hash.words[7]=this._hash.words[7]+w|0}};var zt=[new a(1116352408,3609767458),new a(1899447441,602891725),new a(3049323471,3964484399),new a(3921009573,2173295548),new a(961987163,4081628472),new a(1508970993,3053834265),new a(2453635748,2937671579),new a(2870763221,3664609560),new a(3624381080,2734883394),new a(310598401,1164996542),new a(607225278,1323610764),new a(1426881987,3590304994),new a(1925078388,4068182383),new a(2162078206,991336113),new a(2614888103,633803317),new a(3248222580,3479774868),new a(3835390401,2666613458),new a(4022224774,944711139),new a(264347078,2341262773),new a(604807628,2007800933),new a(770255983,1495990901),new a(1249150122,1856431235),new a(1555081692,3175218132),new a(1996064986,2198950837),new a(2554220882,3999719339),new a(2821834349,766784016),new a(2952996808,2566594879),new a(3210313671,3203337956),new a(3336571891,1034457026),new a(3584528711,2466948901),new a(113926993,3758326383),new a(338241895,168717936),new a(666307205,1188179964),new a(773529912,1546045734),new a(1294757372,1522805485),new a(1396182291,2643833823),new a(1695183700,2343527390),new a(1986661051,1014477480),new a(2177026350,1206759142),new a(2456956037,344077627),new a(2730485921,1290863460),new a(2820302411,3158454273),new a(3259730800,3505952657),new a(3345764771,106217008),new a(3516065817,3606008344),new a(3600352804,1432725776),new a(4094571909,1467031594),new a(275423344,851169720),new a(430227734,3100823752),new a(506948616,1363258195),new a(659060556,3750685593),new a(883997877,3785050280),new a(958139571,3318307427),new a(1322822218,3812723403),new a(1537002063,2003034995),new a(1747873779,3602036899),new a(1955562222,1575990012),new a(2024104815,1125592928),new a(2227730452,2716904306),new a(2361852424,442776044),new a(2428436474,593698344),new a(2756734187,3733110249),new a(3204031479,2999351573),new a(3329325298,3815920427),new a(3391569614,3928383900),new a(3515267271,566280711),new a(3940187606,3454069534),new a(4118630271,4000239992),new a(116418474,1914138554),new a(174292421,2731055270),new a(289380356,3203993006),new a(460393269,320620315),new a(685471733,587496836),new a(852142971,1086792851),new a(1017036298,365543100),new a(1126000580,2618297676),new a(1288033470,3409855158),new a(1501505948,4234509866),new a(1607167915,987167468),new a(1816402316,1246189591)],E=[];(function(){for(let n=0;n<80;n++)E[n]=new a(void 0,void 0)})();var it=class extends g{constructor(){super({blockSize:1024/32})}reset(){super.reset(),this._hash=new V([new a(1779033703,4089235720),new a(3144134277,2227873595),new a(1013904242,4271175723),new a(2773480762,1595750129),new a(1359893119,2917565137),new a(2600822924,725511199),new a(528734635,4215389547),new a(1541459225,327033209)])}_doFinalize(){let t=this._data,s=t.words,r=this._nDataBytes*8,e=t.sigBytes*8;return s[e>>>5]|=128<<24-e%32,s[(e+128>>>10<<5)+30]=Math.floor(r/4294967296),s[(e+128>>>10<<5)+31]=r,t.sigBytes=s.length*4,this._process(),this._hash.toX32()}_doProcessBlock(t,s){let r=this._hash.words[0].high,e=this._hash.words[0].low,o=this._hash.words[1].high,i=this._hash.words[1].low,h=this._hash.words[2].high,c=this._hash.words[2].low,d=this._hash.words[3].high,w=this._hash.words[3].low,p=this._hash.words[4].high,_=this._hash.words[4].low,y=this._hash.words[5].high,F=this._hash.words[5].low,M=this._hash.words[6].high,b=this._hash.words[6].low,C=this._hash.words[7].high,k=this._hash.words[7].low;for(let m=0;m<80;m++){let x,v;if(m<16)v=E[m].high=t[s+m*2]|0,x=E[m].low=t[s+m*2+1]|0;else{let Gt=E[m-15],Y=Gt.high,nt=Gt.low,ss=(Y>>>1|nt<<31)^(Y>>>8|nt<<24)^Y>>>7,At=(nt>>>1|Y<<31)^(nt>>>8|Y<<24)^(nt>>>7|Y<<25),Ot=E[m-2],$=Ot.high,ct=Ot.low,es=($>>>19|ct<<13)^($<<3|ct>>>29)^$>>>6,Lt=(ct>>>19|$<<13)^(ct<<3|$>>>29)^(ct>>>6|$<<26);x=At+E[m-7].low,v=ss+E[m-7].high+(x>>>0<At>>>0?1:0),x=x+Lt,v=v+es+(x>>>0<Lt>>>0?1:0),x=x+E[m-16].low,v=v+E[m-16].high+(x>>>0<E[m-16].low>>>0?1:0),E[m].high=v,E[m].low=x}let ut=p&y^~p&M,Wt=_&F^~_&b,Zt=r&o^r&h^o&h,Jt=e&i^e&c^i&c,Qt=(r>>>28|e<<4)^(r<<30|e>>>2)^(r<<25|e>>>7),Kt=(e>>>28|r<<4)^(e<<30|r>>>2)^(e<<25|r>>>7),Yt=(p>>>14|_<<18)^(p>>>18|_<<14)^(p<<23|_>>>9),$t=(_>>>14|p<<18)^(_>>>18|p<<14)^(_<<23|p>>>9),H=k+$t,O=C+Yt+(H>>>0<k>>>0?1:0);H=H+Wt,O=O+ut+(H>>>0<Wt>>>0?1:0),H=H+zt[m].low,O=O+zt[m].high+(H>>>0<zt[m].low>>>0?1:0),H=H+x,O=O+v+(H>>>0<x>>>0?1:0);let Dt=Kt+Jt,ts=Qt+Zt+(Dt>>>0<Kt>>>0?1:0);C=M,k=b,M=y,b=F,y=p,F=_,_=w+H|0,p=d+O+(_>>>0<w>>>0?1:0)|0,d=h,w=c,h=o,c=i,o=r,i=e,e=H+Dt|0,r=O+ts+(e>>>0<H>>>0?1:0)|0}this._hash.words[0].low=this._hash.words[0].low=this._hash.words[0].low+e,this._hash.words[0].high=this._hash.words[0].high+r+(this._hash.words[0].low>>>0<e>>>0?1:0),this._hash.words[1].low=this._hash.words[1].low=this._hash.words[1].low+i,this._hash.words[1].high=this._hash.words[1].high+o+(this._hash.words[1].low>>>0<i>>>0?1:0),this._hash.words[2].low=this._hash.words[2].low=this._hash.words[2].low+c,this._hash.words[2].high=this._hash.words[2].high+h+(this._hash.words[2].low>>>0<c>>>0?1:0),this._hash.words[3].low=this._hash.words[3].low=this._hash.words[3].low+w,this._hash.words[3].high=this._hash.words[3].high+d+(this._hash.words[3].low>>>0<w>>>0?1:0),this._hash.words[4].low=this._hash.words[4].low=this._hash.words[4].low+_,this._hash.words[4].high=this._hash.words[4].high+p+(this._hash.words[4].low>>>0<_>>>0?1:0),this._hash.words[5].low=this._hash.words[5].low=this._hash.words[5].low+F,this._hash.words[5].high=this._hash.words[5].high+y+(this._hash.words[5].low>>>0<F>>>0?1:0),this._hash.words[6].low=this._hash.words[6].low=this._hash.words[6].low+b,this._hash.words[6].high=this._hash.words[6].high+M+(this._hash.words[6].low>>>0<b>>>0?1:0),this._hash.words[7].low=this._hash.words[7].low=this._hash.words[7].low+k,this._hash.words[7].high=this._hash.words[7].high+C+(this._hash.words[7].low>>>0<k>>>0?1:0)}};var wt=class{static parse(t){let s=t.length,r=[];for(let e=0;e<s;e++)r[e>>>1]|=t.charCodeAt(e)<<16-e%2*16;return new f(r,s*2)}static stringify(t){let s=t.words,r=t.sigBytes,e=[];for(let o=0;o<r;o+=2){let i=s[o>>>2]>>>16-o%4*8&65535;e.push(String.fromCharCode(i))}return e.join("")}};var _t=class{constructor(t,s){this._hasher=new t;let r=typeof s=="string"?L.parse(s):s,e=this._hasher.cfg.blockSize,o=e*4;r.sigBytes>o&&(r=this._hasher.finalize(r)),r.clamp();let i=this._oKey=r.clone(),h=this._iKey=r.clone(),c=i.words,d=h.words;for(let w=0;w<e;w++)c[w]^=1549556828,d[w]^=909522486;i.sigBytes=h.sigBytes=o,this.reset()}finalize(t){let s=this._hasher.finalize(t);return this._hasher.reset(),this._hasher.finalize(this._oKey.clone().concat(s))}reset(){this._hasher.reset(),this._hasher.update(this._iKey)}update(t){return this._hasher.update(t),this}};var mt=class n{constructor(t){this.cfg=Object.assign({keySize:128/32,hasher:T,iterations:25e4},t)}static execute(t,s,r){return new n(r).compute(t,s)}compute(t,s){let r=this.cfg,e=new _t(r.hasher,t),o=new f,i=new f([1]),h=o.words,c=i.words,d=r.keySize,w=r.iterations;for(;h.length<d;){let p=e.update(s).finalize(i);e.reset();let _=p.words,y=_.length,F=p;for(let M=1;M<w;M++){F=e.finalize(F),e.reset();let b=F.words;for(let C=0;C<y;C++)_[C]^=b[C]}o.concat(p),c[0]++}return o.sigBytes=d*4,o}};var bt=u._createHelper(P);var Ct=u._createHelper(z);var vt=g._createHelper(X);var It=g._createHelper(ot);var Et=g._createHelper(T);var Mt=g._createHelper(it);var Rt=u._createHelper(A);var ht=class extends B{constructor(){super(...arguments),this._counter=[]}processBlock(t,s){let r=this._cipher.cfg.blockSize;this._iv&&(this._counter=this._iv.slice(0),this._iv=void 0);let e=this._counter.slice(0);this._cipher.encryptBlock(e,0),this._counter[r-1]=this._counter[r-1]+1|0;for(let o=0;o<r;o++)t[s+o]^=e[o]}};var gt=class extends ht{};var J=class extends W{};J.Decryptor=gt;J.Encryptor=ht;var xt=class extends B{processBlock(t,s){this._cipher.encryptBlock(t,s)}};var yt=class extends B{processBlock(t,s){this._cipher.decryptBlock(t,s)}};var Q=class extends W{};Q.Decryptor=yt;Q.Encryptor=xt;var at=class{static pad(t,s){}static unpad(t){}};
@@ -0,0 +1,7 @@
1
+ export { BlockCipher, CipherParams, Hasher, PasswordBasedCipher, SerializableCipher, WordArray, X64Word, X64WordArray } from "./lib/index.cjs";
2
+ export { AES, DES, MD5, SHA1, SHA256, SHA512, TripleDES } from "./algo/index.cjs";
3
+ export { Base64, Encoder, Hex, Latin1, Utf16, Utf8 } from "./enc/index.cjs";
4
+ export { EVPKDF, PBKDF2 } from "./kdf/index.cjs";
5
+ export { aesHelper, desHelper, md5Helper, sha1Helper, sha256Helper, sha512Helper, tripleDesHelper } from "./helpers/index.cjs";
6
+ export { CBC, CTR, ECB } from "./mode/index.cjs";
7
+ export { NoPadding, PKCS7 } from "./pad/index.cjs";
@@ -0,0 +1,42 @@
1
+ import { WordArray } from "../lib/word-array.class.cjs";
2
+ import { Hasher } from "../lib/hasher.class.cjs";
3
+ import { AbstractKDF } from "./kdf.model.cjs";
4
+ export interface OptionalEVPKDFConfig {
5
+ keySize?: number;
6
+ hasher?: typeof Hasher;
7
+ iterations?: number;
8
+ }
9
+ export interface EVPKDFConfig extends OptionalEVPKDFConfig {
10
+ keySize: number;
11
+ hasher: typeof Hasher;
12
+ iterations: number;
13
+ }
14
+ export declare class EVPKDF implements AbstractKDF {
15
+ cfg: EVPKDFConfig;
16
+ /**
17
+ * Initializes a newly created key derivation function.
18
+ *
19
+ * @param cfg (Optional) The configuration options to use for the derivation.
20
+ *
21
+ * @example
22
+ *
23
+ * let kdf = EvpKDF.create();
24
+ * let kdf = EvpKDF.create({ keySize: 8 });
25
+ * let kdf = EvpKDF.create({ keySize: 8, iterations: 1000 });
26
+ */
27
+ constructor(cfg?: OptionalEVPKDFConfig);
28
+ static execute(password: WordArray | string, salt: WordArray | string, cfg?: OptionalEVPKDFConfig): WordArray;
29
+ /**
30
+ * Derives a key from a password.
31
+ *
32
+ * @param password The password.
33
+ * @param salt A salt.
34
+ *
35
+ * @return The derived key.
36
+ *
37
+ * @example
38
+ *
39
+ * let key = kdf.compute(password, salt);
40
+ */
41
+ compute(password: WordArray | string, salt: WordArray | string): WordArray;
42
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./pbkdf2.class.cjs";
2
+ export * from "./evpkdf.class.cjs";
3
+ export * from "./kdf.model.cjs";