@li0ard/dstu 0.0.1 → 0.1.1

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 (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +52 -45
  3. package/const.d.ts +14 -0
  4. package/const.js +1084 -0
  5. package/dstu4145/const.d.ts +59 -0
  6. package/dstu4145/const.js +197 -0
  7. package/dstu4145/ec/expand.d.ts +6 -0
  8. package/dstu4145/ec/expand.js +129 -0
  9. package/dstu4145/ec/index.d.ts +823 -0
  10. package/dstu4145/ec/index.js +301 -0
  11. package/dstu4145/ec/onb.d.ts +6 -0
  12. package/dstu4145/ec/onb.js +100 -0
  13. package/dstu4145/ec/wnaf.d.ts +4 -0
  14. package/dstu4145/ec/wnaf.js +63 -0
  15. package/dstu4145/index.d.ts +180 -0
  16. package/dstu4145/index.js +93 -0
  17. package/index.d.ts +6 -0
  18. package/index.js +6 -0
  19. package/kalyna/index.d.ts +51 -0
  20. package/kalyna/index.js +210 -0
  21. package/kupyna/index.d.ts +162 -0
  22. package/kupyna/index.js +233 -0
  23. package/kupyna/kmac.d.ts +46 -0
  24. package/kupyna/kmac.js +124 -0
  25. package/modes/cbc.d.ts +5 -0
  26. package/modes/cbc.js +34 -0
  27. package/modes/cfb.d.ts +5 -0
  28. package/modes/cfb.js +72 -0
  29. package/modes/ctr.d.ts +5 -0
  30. package/modes/ctr.js +24 -0
  31. package/modes/ecb.d.ts +4 -0
  32. package/modes/ecb.js +17 -0
  33. package/modes/gcm.d.ts +5 -0
  34. package/modes/gcm.js +20 -0
  35. package/modes/index.d.ts +7 -0
  36. package/modes/index.js +7 -0
  37. package/modes/mac.d.ts +6 -0
  38. package/modes/mac.js +65 -0
  39. package/modes/ofb.d.ts +5 -0
  40. package/modes/ofb.js +20 -0
  41. package/package.json +49 -7
  42. package/padding.d.ts +3 -0
  43. package/padding.js +22 -0
  44. package/strumok/index.d.ts +21 -0
  45. package/strumok/index.js +352 -0
  46. package/types.d.ts +41 -0
  47. package/types.js +1 -0
  48. package/utils.d.ts +14 -0
  49. package/utils.js +81 -0
@@ -0,0 +1,93 @@
1
+ import { concatBytes, randomBytes } from "@noble/hashes/utils.js";
2
+ import { DSTU_163, DSTU_163_TEST, DSTU_167, DSTU_173, DSTU_173_ONB, DSTU_173_ONB_TEST, DSTU_179, DSTU_179_ONB, DSTU_191, DSTU_191_ONB, DSTU_233, DSTU_233_ONB, DSTU_257, DSTU_307, DSTU_367, DSTU_431, DSTU_431_ONB } from "./const.js";
3
+ import { binaryWeierstrass } from "./ec/index.js";
4
+ import BN from "bn.js";
5
+ /** Create DSTU 4145-2002 signer (Big-Endian) */
6
+ export const dstu4145 = (parameters) => {
7
+ const curve = binaryWeierstrass(parameters);
8
+ const k = curve.ORDER.getLength() - 1;
9
+ const getPublicKey = (secretKey, isCompressed = false) => curve.Point.BASE.mul(curve.Field.fromBytes(secretKey)).negate().toBytes(isCompressed);
10
+ const randomPrivateKey = () => new Uint8Array(new BN(randomBytes(curve.lengths.scalarByteLength))
11
+ .maskn(k)
12
+ .toArray("be", curve.lengths.scalarByteLength));
13
+ const computePresign = (rand) => {
14
+ const e = (rand
15
+ ? new BN(rand)
16
+ : new BN(randomBytes(curve.lengths.scalarByteLength))).maskn(k);
17
+ if (rand && e.isZero())
18
+ throw new Error("Invalid custom rand for presign (rand = 0)");
19
+ if (e.isZero())
20
+ return computePresign(rand);
21
+ const xR = curve.Point.BASE.mul(new curve.Field(e)).x;
22
+ if (xR.is0())
23
+ return computePresign(rand);
24
+ return { Fe: xR, e };
25
+ };
26
+ const prepareHash = (digest) => {
27
+ let h = curve.toInternalField(curve.hashToField(digest));
28
+ if (h.is0())
29
+ h = curve.Field.get1();
30
+ return h;
31
+ };
32
+ const sign = (secretKey, digest, rand) => {
33
+ const d = new BN(secretKey).mod(curve.ORDER.value);
34
+ const h = prepareHash(digest);
35
+ const { Fe, e } = computePresign(rand);
36
+ const r = curve.toExternalField(h.mul(Fe)).value.maskn(k);
37
+ if (r.isZero())
38
+ return sign(secretKey, digest, rand);
39
+ const s = e.add(d.mul(r)).mod(curve.ORDER.value);
40
+ if (s.isZero())
41
+ return sign(secretKey, digest, rand);
42
+ return concatBytes(new Uint8Array(s.toArray("be", curve.lengths.scalarByteLength)), new Uint8Array(r.toArray("be", curve.lengths.scalarByteLength)));
43
+ };
44
+ const verify = (publicKey, digest, signature) => {
45
+ if (signature.length != curve.lengths.signatureByteLength)
46
+ throw new Error("Invalid signature length");
47
+ const Q = curve.Point.fromBytes(publicKey);
48
+ const _s = curve.Field.fromBytes(signature.subarray(0, curve.lengths.scalarByteLength)), _r = curve.Field.fromBytes(signature.subarray(curve.lengths.scalarByteLength));
49
+ if (_s.value.isZero() || _s.value.gte(curve.ORDER.value)
50
+ || _r.value.isZero() || _r.value.gte(curve.ORDER.value))
51
+ return false;
52
+ const h = prepareHash(digest);
53
+ const R = curve.Point.BASE.mulWnaf(_s).add(Q.mulWnaf(_r));
54
+ const y = curve.toExternalField(h.mul(R.x)).value.maskn(k);
55
+ return y.eq(_r.value);
56
+ };
57
+ const keygen = (isCompressed = false) => {
58
+ const secretKey = randomPrivateKey();
59
+ const publicKey = getPublicKey(secretKey, isCompressed);
60
+ return { secretKey, publicKey };
61
+ };
62
+ return Object.freeze({
63
+ getPublicKey,
64
+ sign,
65
+ verify,
66
+ keygen,
67
+ lengths: curve.lengths
68
+ });
69
+ };
70
+ export * from "./const.js";
71
+ export * from "./ec/expand.js";
72
+ // ONB curves don't preinitialized because `multiplyOnb` is slow O(m^3) function
73
+ // You need to initialize it manually via `dstu4145`
74
+ /** DSTU 4145-2002 163 bit curve */
75
+ export const dstu163 = dstu4145(DSTU_163);
76
+ /** DSTU 4145-2002 167 bit curve */
77
+ export const dstu167 = dstu4145(DSTU_167);
78
+ /** DSTU 4145-2002 173 bit curve */
79
+ export const dstu173 = dstu4145(DSTU_173);
80
+ /** DSTU 4145-2002 179 bit curve */
81
+ export const dstu179 = dstu4145(DSTU_179);
82
+ /** DSTU 4145-2002 191 bit curve */
83
+ export const dstu191 = dstu4145(DSTU_191);
84
+ /** DSTU 4145-2002 233 bit curve */
85
+ export const dstu233 = dstu4145(DSTU_233);
86
+ /** DSTU 4145-2002 257 bit curve */
87
+ export const dstu257 = dstu4145(DSTU_257);
88
+ /** DSTU 4145-2002 307 bit curve */
89
+ export const dstu307 = dstu4145(DSTU_307);
90
+ /** DSTU 4145-2002 367 bit curve */
91
+ export const dstu367 = dstu4145(DSTU_367);
92
+ /** DSTU 4145-2002 431 bit curve */
93
+ export const dstu431 = dstu4145(DSTU_431);
package/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ export * from "./dstu4145/index.js";
2
+ export { Kalyna128, Kalyna128_256, Kalyna256, Kalyna256_512, Kalyna512 } from "./kalyna/index.js";
3
+ export * from "./kupyna/index.js";
4
+ export * from "./modes/index.js";
5
+ export * from "./strumok/index.js";
6
+ export * from "./types.js";
package/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export * from "./dstu4145/index.js";
2
+ export { Kalyna128, Kalyna128_256, Kalyna256, Kalyna256_512, Kalyna512 } from "./kalyna/index.js";
3
+ export * from "./kupyna/index.js";
4
+ export * from "./modes/index.js";
5
+ export * from "./strumok/index.js";
6
+ export * from "./types.js";
@@ -0,0 +1,51 @@
1
+ import type { TArg, TRet } from "@noble/hashes/utils.js";
2
+ import type { Cipher } from "../types.js";
3
+ export declare const column: (x: TArg<BigUint64Array>, i: number, N: number, c1: number, c2: number, c3: number, c4: number, c5: number, c6: number, c7: number) => bigint;
4
+ export declare abstract class Kalyna implements Cipher {
5
+ readonly N: number;
6
+ /** Block size */
7
+ readonly blockSize: number;
8
+ /** Key size */
9
+ readonly keySize: number;
10
+ private erk;
11
+ private drk;
12
+ private readonly numRounds;
13
+ private readonly glOffset;
14
+ private wordOffsets;
15
+ /** Kalyna abstract class */
16
+ constructor(key: TArg<Uint8Array>, N: number, isDouble?: boolean);
17
+ private expandKey;
18
+ private makeOddKey;
19
+ private addkey;
20
+ private subkey;
21
+ private column;
22
+ private G;
23
+ private GL;
24
+ private IMC;
25
+ private IG;
26
+ private IGL;
27
+ /** Encrypt block */
28
+ encrypt(block: TArg<Uint8Array>): TRet<Uint8Array>;
29
+ /** Decrypt block */
30
+ decrypt(block: TArg<Uint8Array>): TRet<Uint8Array>;
31
+ }
32
+ /** Kalyna 128/128 bit version */
33
+ export declare class Kalyna128 extends Kalyna {
34
+ constructor(key: TArg<Uint8Array>);
35
+ }
36
+ /** Kalyna 128/256 bit version */
37
+ export declare class Kalyna128_256 extends Kalyna {
38
+ constructor(key: TArg<Uint8Array>);
39
+ }
40
+ /** Kalyna 256 bit version */
41
+ export declare class Kalyna256 extends Kalyna {
42
+ constructor(key: TArg<Uint8Array>);
43
+ }
44
+ /** Kalyna 256/512 bit version */
45
+ export declare class Kalyna256_512 extends Kalyna {
46
+ constructor(key: TArg<Uint8Array>);
47
+ }
48
+ /** Kalyna 512 bit version */
49
+ export declare class Kalyna512 extends Kalyna {
50
+ constructor(key: TArg<Uint8Array>);
51
+ }
@@ -0,0 +1,210 @@
1
+ import { IS, IT, T, S } from "../const.js";
2
+ import { bytesToUint64sLE, uint64sToBytesLE, byte } from "../utils.js";
3
+ const swap_block = (k, N) => {
4
+ if (N <= 1)
5
+ return;
6
+ const t = k[0];
7
+ for (let i = 0; i < N - 1; i++)
8
+ k[i] = k[i + 1];
9
+ k[N - 1] = t;
10
+ };
11
+ export const column = (x, i, N, c1, c2, c3, c4, c5, c6, c7) => (T[0][byte(x[(i + N) % N])] ^ // c0 - always 0 for both Kalyna and Kupyna
12
+ T[1][byte(x[(i - c1 + N) % N] >> 8n)] ^
13
+ T[2][byte(x[(i - c2 + N) % N] >> 16n)] ^
14
+ T[3][byte(x[(i - c3 + N) % N] >> 24n)] ^
15
+ T[4][byte(x[(i - c4 + N) % N] >> 32n)] ^
16
+ T[5][byte(x[(i - c5 + N) % N] >> 40n)] ^
17
+ T[6][byte(x[(i - c6 + N) % N] >> 48n)] ^
18
+ T[7][byte(x[(i - c7 + N) % N] >> 56n)]);
19
+ export class Kalyna {
20
+ N;
21
+ /** Block size */
22
+ blockSize;
23
+ /** Key size */
24
+ keySize;
25
+ erk;
26
+ drk;
27
+ numRounds;
28
+ glOffset;
29
+ wordOffsets;
30
+ /** Kalyna abstract class */
31
+ constructor(key, N, isDouble = false) {
32
+ this.N = N;
33
+ if (N < 2 || (N & (N - 1)) !== 0)
34
+ throw new Error("N must be power of 2 and >= 2");
35
+ this.blockSize = N << 3;
36
+ this.keySize = this.blockSize;
37
+ if (isDouble)
38
+ this.keySize *= 2;
39
+ if (key.length !== this.keySize)
40
+ throw new Error("Invalid key length");
41
+ this.wordOffsets = Array.from({ length: 8 }, (_, j) => Math.floor(j * this.N / 8));
42
+ const X = 6 + 4 * Math.log2(N) + (isDouble ? 4 : 0);
43
+ this.numRounds = X - (N > 2 || isDouble ? 1 : 0);
44
+ this.glOffset = X * N;
45
+ this.expandKey(key);
46
+ }
47
+ expandKey(key) {
48
+ const log2N = Math.log2(this.N), isDoubleKey = (this.keySize === this.blockSize * 2), R = isDoubleKey ? (6 + 2 * log2N) : (4 + 2 * log2N), rk = new BigUint64Array(R * this.N * 2), ks = new BigUint64Array(this.N), ksc = new BigUint64Array(this.N), t1 = new BigUint64Array(this.N), t2 = new BigUint64Array(this.N);
49
+ t1[0] = isDoubleKey ? BigInt(2 * this.N + 2 * log2N + 1) : BigInt(2 * this.N + 1);
50
+ const keys = bytesToUint64sLE(key);
51
+ let k = new BigUint64Array(isDoubleKey ? this.N * 2 : this.N);
52
+ const _0 = new BigUint64Array(this.N);
53
+ if (isDoubleKey) {
54
+ const ka = keys.subarray(0, this.N);
55
+ this.addkey(t1, t2, ka);
56
+ this.G(t2, t1, keys.subarray(this.N));
57
+ this.GL(t1, t2, ka);
58
+ this.G(t2, ks, _0);
59
+ k.set(keys);
60
+ }
61
+ else {
62
+ k.set(keys.subarray(0, this.N));
63
+ this.addkey(t1, t2, keys);
64
+ this.G(t2, t1, keys);
65
+ this.GL(t1, t2, keys);
66
+ this.G(t2, ks, _0);
67
+ }
68
+ let constant = 0x0001000100010001n;
69
+ for (let i = 0; i < R; i++) {
70
+ const offset = i * (this.N * 2);
71
+ if (i > 0) {
72
+ if (!isDoubleKey)
73
+ swap_block(k, this.N);
74
+ else if (i % 2 === 0)
75
+ swap_block(k, this.N * 2);
76
+ }
77
+ const keySource = isDoubleKey
78
+ ? (i % 2 === 0 ? k.subarray(0, this.N) : k.subarray(this.N))
79
+ : k;
80
+ for (let i = 0; i < this.N; i++)
81
+ ksc[i] = ks[i] + constant;
82
+ this.addkey(keySource, t2, ksc);
83
+ this.G(t2, t1, ksc);
84
+ this.GL(t1, rk.subarray(offset), ksc);
85
+ if (i < R - 1)
86
+ this.makeOddKey(rk.subarray(offset), rk.subarray(offset + this.N));
87
+ constant <<= 1n;
88
+ }
89
+ this.erk = rk.slice();
90
+ for (let i = ((R * 2 - 3) * this.N); i > 0; i -= this.N)
91
+ this.IMC(rk.subarray(i));
92
+ this.drk = rk;
93
+ }
94
+ makeOddKey(evenkey, oddkey) {
95
+ const offset = 2 * this.N + 3;
96
+ const evenkeys = uint64sToBytesLE(evenkey);
97
+ const oddkeys = uint64sToBytesLE(oddkey);
98
+ oddkeys.set(evenkeys.subarray(offset, this.blockSize));
99
+ oddkeys.set(evenkeys.subarray(0, offset), this.blockSize - offset);
100
+ oddkey.set(bytesToUint64sLE(oddkeys));
101
+ }
102
+ addkey(x, y, k) {
103
+ for (let i = 0; i < this.N; i++)
104
+ y[i] = x[i] + k[i];
105
+ }
106
+ subkey(x, y, k) {
107
+ for (let i = 0; i < this.N; i++)
108
+ y[i] = x[i] - k[i];
109
+ }
110
+ column(x, i) {
111
+ return column(x, i, this.N, this.wordOffsets[1], this.wordOffsets[2], this.wordOffsets[3], this.wordOffsets[4], this.wordOffsets[5], this.wordOffsets[6], this.wordOffsets[7]);
112
+ }
113
+ G(x, y, k) {
114
+ for (let i = 0; i < this.N; i++)
115
+ y[i] = k[i] ^ this.column(x, i);
116
+ }
117
+ GL(x, y, k) {
118
+ for (let i = 0; i < this.N; i++)
119
+ y[i] = k[i] + this.column(x, i);
120
+ }
121
+ IMC(x) {
122
+ for (let i = 0; i < this.N; i++)
123
+ x[i] = IT[0][S[0][byte(x[i])]] ^
124
+ IT[1][S[1][byte(x[i] >> 8n)]] ^
125
+ IT[2][S[2][byte(x[i] >> 16n)]] ^
126
+ IT[3][S[3][byte(x[i] >> 24n)]] ^
127
+ IT[4][S[0][byte(x[i] >> 32n)]] ^
128
+ IT[5][S[1][byte(x[i] >> 40n)]] ^
129
+ IT[6][S[2][byte(x[i] >> 48n)]] ^
130
+ IT[7][S[3][byte(x[i] >> 56n)]];
131
+ }
132
+ IG(x, y, k) {
133
+ for (let i = 0; i < this.N; i++)
134
+ y[i] = k[i] ^
135
+ IT[0][byte(x[(i + this.wordOffsets[0]) % this.N])] ^
136
+ IT[1][byte(x[(i + this.wordOffsets[1]) % this.N] >> 8n)] ^
137
+ IT[2][byte(x[(i + this.wordOffsets[2]) % this.N] >> 16n)] ^
138
+ IT[3][byte(x[(i + this.wordOffsets[3]) % this.N] >> 24n)] ^
139
+ IT[4][byte(x[(i + this.wordOffsets[4]) % this.N] >> 32n)] ^
140
+ IT[5][byte(x[(i + this.wordOffsets[5]) % this.N] >> 40n)] ^
141
+ IT[6][byte(x[(i + this.wordOffsets[6]) % this.N] >> 48n)] ^
142
+ IT[7][byte(x[(i + this.wordOffsets[7]) % this.N] >> 56n)];
143
+ }
144
+ IGL(x, y, k) {
145
+ for (let i = 0; i < this.N; i++) {
146
+ let result = BigInt(IS[0][byte(x[(i + this.wordOffsets[0]) % this.N])]);
147
+ result ^= BigInt(IS[1][byte(x[(i + this.wordOffsets[1]) % this.N] >> 8n)]) << 8n;
148
+ result ^= BigInt(IS[2][byte(x[(i + this.wordOffsets[2]) % this.N] >> 16n)]) << 16n;
149
+ result ^= BigInt(IS[3][byte(x[(i + this.wordOffsets[3]) % this.N] >> 24n)]) << 24n;
150
+ result ^= BigInt(IS[0][byte(x[(i + this.wordOffsets[4]) % this.N] >> 32n)]) << 32n;
151
+ result ^= BigInt(IS[1][byte(x[(i + this.wordOffsets[5]) % this.N] >> 40n)]) << 40n;
152
+ result ^= BigInt(IS[2][byte(x[(i + this.wordOffsets[6]) % this.N] >> 48n)]) << 48n;
153
+ result ^= BigInt(IS[3][byte(x[(i + this.wordOffsets[7]) % this.N] >> 56n)]) << 56n;
154
+ y[i] = result - k[i];
155
+ }
156
+ }
157
+ /** Encrypt block */
158
+ encrypt(block) {
159
+ if (block.length != this.blockSize)
160
+ throw new Error(`Incorrect length (need - ${this.blockSize}, got - ${block.length})`);
161
+ const t1 = new BigUint64Array(this.N), t2 = new BigUint64Array(this.N);
162
+ this.addkey(bytesToUint64sLE(block), t1, this.erk);
163
+ for (let i = 0; i < this.numRounds; i++) {
164
+ const roundKey = this.erk.subarray(this.N + i * this.N);
165
+ if (i % 2 === 0)
166
+ this.G(t1, t2, roundKey);
167
+ else
168
+ this.G(t2, t1, roundKey);
169
+ }
170
+ this.GL(t2, t1, this.erk.subarray(this.glOffset));
171
+ return uint64sToBytesLE(t1);
172
+ }
173
+ /** Decrypt block */
174
+ decrypt(block) {
175
+ if (block.length != this.blockSize)
176
+ throw new Error(`Incorrect length (need - ${this.blockSize}, got - ${block.length})`);
177
+ const t1 = new BigUint64Array(this.N), t2 = new BigUint64Array(this.N);
178
+ this.subkey(bytesToUint64sLE(block), t1, this.drk.subarray(this.glOffset));
179
+ this.IMC(t1);
180
+ for (let i = 0; i < this.numRounds; i++) {
181
+ const roundKey = this.drk.subarray(this.glOffset - this.N - i * this.N);
182
+ if (i % 2 === 0)
183
+ this.IG(t1, t2, roundKey);
184
+ else
185
+ this.IG(t2, t1, roundKey);
186
+ }
187
+ this.IGL(t2, t1, this.drk);
188
+ return uint64sToBytesLE(t1);
189
+ }
190
+ }
191
+ /** Kalyna 128/128 bit version */
192
+ export class Kalyna128 extends Kalyna {
193
+ constructor(key) { super(key, 2); }
194
+ }
195
+ /** Kalyna 128/256 bit version */
196
+ export class Kalyna128_256 extends Kalyna {
197
+ constructor(key) { super(key, 2, true); }
198
+ }
199
+ /** Kalyna 256 bit version */
200
+ export class Kalyna256 extends Kalyna {
201
+ constructor(key) { super(key, 4); }
202
+ }
203
+ /** Kalyna 256/512 bit version */
204
+ export class Kalyna256_512 extends Kalyna {
205
+ constructor(key) { super(key, 4, true); }
206
+ }
207
+ /** Kalyna 512 bit version */
208
+ export class Kalyna512 extends Kalyna {
209
+ constructor(key) { super(key, 8); }
210
+ }
@@ -0,0 +1,162 @@
1
+ import { type Hash, type TArg, type TRet } from "@noble/hashes/utils.js";
2
+ declare abstract class Kupyna<T extends Kupyna<T>> implements Hash<Kupyna<T>> {
3
+ readonly blockLen: number;
4
+ readonly outputLen: number;
5
+ readonly canXOF = false;
6
+ private readonly rounds;
7
+ private readonly stSize;
8
+ private readonly threshold;
9
+ protected s: BigUint64Array;
10
+ protected x: Uint8Array;
11
+ protected nx: number;
12
+ protected len: bigint;
13
+ constructor(blockLen: number);
14
+ destroy(): void;
15
+ update(data: TArg<Uint8Array>): this;
16
+ digest(): TRet<Uint8Array>;
17
+ digestInto(buffer: TArg<Uint8Array>): void;
18
+ private column;
19
+ private G;
20
+ private P;
21
+ private Q;
22
+ private outputTransform;
23
+ private F;
24
+ abstract clone(): Kupyna<T>;
25
+ abstract _cloneInto(): Kupyna<T>;
26
+ }
27
+ declare abstract class KupynaDerived<T extends Kupyna<T>> implements Hash<KupynaDerived<T>> {
28
+ hash: () => Kupyna<T>;
29
+ private readonly slice;
30
+ readonly outputLen: number;
31
+ readonly blockLen: number;
32
+ readonly canXOF = false;
33
+ buffer: Uint8Array;
34
+ constructor(hash: () => Kupyna<T>, slice: number);
35
+ destroy(): void;
36
+ abstract clone(): KupynaDerived<T>;
37
+ abstract _cloneInto(): KupynaDerived<T>;
38
+ update(data: TArg<Uint8Array>): this;
39
+ digest(): TRet<Uint8Array>;
40
+ digestInto(buffer: TArg<Uint8Array>): void;
41
+ }
42
+ /** Kupyna 256 bit version */
43
+ export declare class Kupyna256 extends Kupyna<Kupyna256> {
44
+ /** Kupyna 256 bit version */
45
+ constructor();
46
+ _cloneInto(to?: Kupyna256): Kupyna256;
47
+ clone(): Kupyna256;
48
+ /** Create hash instance */
49
+ static create(): Kupyna256;
50
+ }
51
+ /** Kupyna 512 bit version */
52
+ export declare class Kupyna512 extends Kupyna<Kupyna512> {
53
+ /** Kupyna 512 bit version */
54
+ constructor();
55
+ _cloneInto(to?: Kupyna512): Kupyna512;
56
+ clone(): Kupyna512;
57
+ /** Create hash instance */
58
+ static create(): Kupyna512;
59
+ }
60
+ /** Kupyna 48 bit version */
61
+ export declare class Kupyna48 extends KupynaDerived<Kupyna256> {
62
+ /** Kupyna 48 bit version */
63
+ constructor();
64
+ /** Create hash instance */
65
+ static create(): Kupyna48;
66
+ _cloneInto(to?: Kupyna48): Kupyna48;
67
+ clone(): Kupyna48;
68
+ }
69
+ /** Kupyna 304 bit version */
70
+ export declare class Kupyna304 extends KupynaDerived<Kupyna512> {
71
+ /** Kupyna 304 bit version */
72
+ constructor();
73
+ /** Create hash instance */
74
+ static create(): Kupyna304;
75
+ _cloneInto(to?: Kupyna304): Kupyna304;
76
+ clone(): Kupyna304;
77
+ }
78
+ /** Kupyna 384 bit version */
79
+ export declare class Kupyna384 extends KupynaDerived<Kupyna512> {
80
+ /** Kupyna 384 bit version */
81
+ constructor();
82
+ /** Create hash instance */
83
+ static create(): Kupyna384;
84
+ _cloneInto(to?: Kupyna384): Kupyna384;
85
+ clone(): Kupyna384;
86
+ }
87
+ /** Kupyna 48 bit version */
88
+ export declare const kupyna48: {
89
+ outputLen: number;
90
+ blockLen: number;
91
+ canXOF: boolean;
92
+ } & import("@noble/hashes/utils.js").HashInfo & {
93
+ (msg: TArg<Uint8Array>): TRet<Uint8Array>;
94
+ create(): Kupyna48;
95
+ } & ((msg: TArg<TArg<Uint8Array<ArrayBufferLike>>>) => Uint8Array<ArrayBufferLike> & Uint8Array<ArrayBuffer>) & {
96
+ outputLen: number;
97
+ blockLen: number;
98
+ canXOF: boolean;
99
+ oid?: TRet<Uint8Array> | undefined;
100
+ create: () => Kupyna48;
101
+ };
102
+ /** Kupyna 256 bit version */
103
+ export declare const kupyna256: {
104
+ outputLen: number;
105
+ blockLen: number;
106
+ canXOF: boolean;
107
+ } & import("@noble/hashes/utils.js").HashInfo & {
108
+ (msg: TArg<Uint8Array>): TRet<Uint8Array>;
109
+ create(): Kupyna256;
110
+ } & ((msg: TArg<TArg<Uint8Array<ArrayBufferLike>>>) => Uint8Array<ArrayBufferLike> & Uint8Array<ArrayBuffer>) & {
111
+ outputLen: number;
112
+ blockLen: number;
113
+ canXOF: boolean;
114
+ oid?: TRet<Uint8Array> | undefined;
115
+ create: () => Kupyna256;
116
+ };
117
+ /** Kupyna 304 bit version */
118
+ export declare const kupyna304: {
119
+ outputLen: number;
120
+ blockLen: number;
121
+ canXOF: boolean;
122
+ } & import("@noble/hashes/utils.js").HashInfo & {
123
+ (msg: TArg<Uint8Array>): TRet<Uint8Array>;
124
+ create(): Kupyna304;
125
+ } & ((msg: TArg<TArg<Uint8Array<ArrayBufferLike>>>) => Uint8Array<ArrayBufferLike> & Uint8Array<ArrayBuffer>) & {
126
+ outputLen: number;
127
+ blockLen: number;
128
+ canXOF: boolean;
129
+ oid?: TRet<Uint8Array> | undefined;
130
+ create: () => Kupyna304;
131
+ };
132
+ /** Kupyna 384 bit version */
133
+ export declare const kupyna384: {
134
+ outputLen: number;
135
+ blockLen: number;
136
+ canXOF: boolean;
137
+ } & import("@noble/hashes/utils.js").HashInfo & {
138
+ (msg: TArg<Uint8Array>): TRet<Uint8Array>;
139
+ create(): Kupyna384;
140
+ } & ((msg: TArg<TArg<Uint8Array<ArrayBufferLike>>>) => Uint8Array<ArrayBufferLike> & Uint8Array<ArrayBuffer>) & {
141
+ outputLen: number;
142
+ blockLen: number;
143
+ canXOF: boolean;
144
+ oid?: TRet<Uint8Array> | undefined;
145
+ create: () => Kupyna384;
146
+ };
147
+ /** Kupyna 512 bit version */
148
+ export declare const kupyna512: {
149
+ outputLen: number;
150
+ blockLen: number;
151
+ canXOF: boolean;
152
+ } & import("@noble/hashes/utils.js").HashInfo & {
153
+ (msg: TArg<Uint8Array>): TRet<Uint8Array>;
154
+ create(): Kupyna512;
155
+ } & ((msg: TArg<TArg<Uint8Array<ArrayBufferLike>>>) => Uint8Array<ArrayBufferLike> & Uint8Array<ArrayBuffer>) & {
156
+ outputLen: number;
157
+ blockLen: number;
158
+ canXOF: boolean;
159
+ oid?: TRet<Uint8Array> | undefined;
160
+ create: () => Kupyna512;
161
+ };
162
+ export * from "./kmac.js";