@li0ard/dstu 0.2.0 → 0.2.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/const.d.ts +5 -14
  2. package/const.js +47 -1010
  3. package/dstu4145/const.js +15 -15
  4. package/dstu4145/ec/index.js +9 -27
  5. package/dstu4145/ecies.d.ts +2 -2
  6. package/dstu4145/ecies.js +2 -1
  7. package/dstu4145/gf2m/utils.js +1 -1
  8. package/dstu4145/index.js +12 -12
  9. package/dstu9041/curve.d.ts +1 -1
  10. package/dstu9041/curve.js +14 -27
  11. package/dstu9041/index.js +12 -20
  12. package/dstu9311/const.js +12 -12
  13. package/dstu9311/index.d.ts +1 -2
  14. package/dstu9311/index.js +34 -30
  15. package/gf/index.d.ts +5 -0
  16. package/gf/index.js +62 -0
  17. package/gost34311/index.d.ts +55 -0
  18. package/gost34311/index.js +167 -0
  19. package/index.d.ts +1 -0
  20. package/index.js +1 -0
  21. package/iso15946.js +4 -6
  22. package/kalyna/index.d.ts +2 -4
  23. package/kalyna/index.js +113 -92
  24. package/keywrap.js +5 -10
  25. package/kupyna/index.d.ts +21 -103
  26. package/kupyna/index.js +104 -153
  27. package/modes/_guard.d.ts +4 -0
  28. package/modes/_guard.js +6 -0
  29. package/modes/cbc.js +2 -1
  30. package/modes/ccm.js +1 -1
  31. package/modes/cfb.js +2 -1
  32. package/modes/cmac.js +2 -1
  33. package/modes/ctr.js +2 -1
  34. package/modes/gcm.js +2 -1
  35. package/modes/gmac.js +4 -8
  36. package/modes/kw.js +1 -1
  37. package/modes/ofb.js +2 -1
  38. package/modes/xts.js +11 -25
  39. package/package.json +12 -9
  40. package/padding.d.ts +1 -1
  41. package/padding.js +0 -5
  42. package/strumok/index.d.ts +3 -4
  43. package/strumok/index.js +128 -85
  44. package/utils.d.ts +6 -13
  45. package/utils.js +27 -70
  46. package/dstu9311/hash.d.ts +0 -75
  47. package/dstu9311/hash.js +0 -159
  48. package/kupyna/kmac.d.ts +0 -46
  49. package/kupyna/kmac.js +0 -130
package/dstu9311/index.js CHANGED
@@ -1,51 +1,56 @@
1
- import { abytes, concatBytes, createView } from "@noble/hashes/utils.js";
1
+ import { abytes, createView } from "@noble/hashes/utils.js";
2
2
  import { DKE_1, keySequences } from "./const.js";
3
- import { bytesToNumberLE, numberToBytesLE } from "@noble/curves/utils.js";
4
- const G = (v, sbox) => {
5
- const nibble = (r, i) => {
6
- const b = sbox[r + (i >> 1)];
7
- return (i & 1) == 0 ? (b >>> 4) : (b & 0x0f);
8
- };
9
- const t = (nibble(0, v & 0x0f) << 0) |
10
- (nibble(8, (v >> 4) & 0x0f) << 4) |
11
- (nibble(16, (v >> 8) & 0x0f) << 8) |
12
- (nibble(24, (v >> 12) & 0x0f) << 12) |
13
- (nibble(32, (v >> 16) & 0x0f) << 16) |
14
- (nibble(40, (v >> 20) & 0x0f) << 20) |
15
- (nibble(48, (v >> 24) & 0x0f) << 24) |
16
- (nibble(56, (v >> 28) & 0x0f) << 28);
17
- return ((t << 11) | (t >>> 21)) >>> 0;
3
+ const nibble = (sbox, r, i) => {
4
+ const b = sbox[(r << 3) + (i >> 1)];
5
+ return (i & 1) === 0 ? (b >>> 4) : (b & 0x0f);
18
6
  };
19
- const extendKey = (key, sequence) => {
20
- const view = createView(key);
21
- const result = new Uint32Array(sequence.length);
22
- for (let i = 0; i < sequence.length; i++)
23
- result[i] = view.getUint32(sequence[i] * 4, true);
24
- return result;
7
+ const genTable = (sbox) => {
8
+ const table = new Uint32Array(4 * 256);
9
+ for (let k = 0; k < 4; k++) {
10
+ for (let v = 0; v < 256; v++) {
11
+ const x = ((nibble(sbox, 2 * k + 1, v >> 4) << 4) | nibble(sbox, 2 * k, v & 15)) << (8 * k);
12
+ table[(k << 8) | v] = (x << 11) | (x >>> 21);
13
+ }
14
+ }
15
+ return table;
16
+ };
17
+ const TABLES = /* @__PURE__ */ new WeakMap();
18
+ const getTable = (sbox) => {
19
+ let t = TABLES.get(sbox);
20
+ if (!t)
21
+ TABLES.set(sbox, t = genTable(sbox));
22
+ return t;
25
23
  };
24
+ const G = (v, t) => t[v & 0xff] ^ t[256 + ((v >>> 8) & 0xff)] ^
25
+ t[512 + ((v >>> 16) & 0xff)] ^ t[768 + (v >>> 24)];
26
26
  /** DSTU 9311:2024 cipher (Revised DSTU GOST 28147:2009) */
27
27
  export class Dstu9311 {
28
- key;
29
28
  sbox;
30
29
  keySize = 32;
31
30
  blockSize = 8;
31
+ rk = new Uint32Array(8);
32
32
  /** DSTU 9311:2024 cipher (Revised DSTU GOST 28147:2009) */
33
33
  constructor(key, sbox = DKE_1) {
34
- this.key = key;
35
34
  this.sbox = sbox;
36
35
  abytes(key, this.keySize, "key");
37
36
  abytes(sbox, 64, "sbox");
37
+ const view = createView(key);
38
+ for (let i = 0; i < 8; i++)
39
+ this.rk[i] = view.getUint32(i * 4, true);
38
40
  }
39
41
  proceedBlock(block, sequence) {
40
42
  abytes(block, this.blockSize, "block");
41
- const roundKeys = extendKey(this.key, sequence);
42
- let a0 = Number(bytesToNumberLE(block.subarray(4, 8))), a1 = Number(bytesToNumberLE(block.subarray(0, 4)));
43
- for (let i = 0; i < roundKeys.length; i++) {
43
+ const inView = createView(block), t = getTable(this.sbox);
44
+ let a0 = inView.getUint32(4, true), a1 = inView.getUint32(0, true);
45
+ for (let i = 0; i < sequence.length; i++) {
44
46
  const temp = a1;
45
- a1 = (a0 ^ G((a1 + roundKeys[i]) >>> 0, this.sbox)) >>> 0;
47
+ a1 = (a0 ^ G((a1 + this.rk[sequence[i]]) >>> 0, t)) >>> 0;
46
48
  a0 = temp;
47
49
  }
48
- return concatBytes(numberToBytesLE(a0, 4), numberToBytesLE(a1, 4));
50
+ const out = new Uint8Array(this.blockSize), outView = createView(out);
51
+ outView.setUint32(0, a0, true);
52
+ outView.setUint32(4, a1, true);
53
+ return out;
49
54
  }
50
55
  encrypt(plaintext) {
51
56
  return this.proceedBlock(plaintext, keySequences.ENCRYPT);
@@ -55,4 +60,3 @@ export class Dstu9311 {
55
60
  }
56
61
  }
57
62
  export * from "./const.js";
58
- export * from "./hash.js";
package/gf/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { type TArg, type TRet } from "@noble/hashes/utils.js";
2
+ export declare const gf256Multiply: (a: number, b: number) => number;
3
+ export declare const getGf2mReductionBytes: (blockSize: number) => number[];
4
+ export declare const gf2mMultiply: (blockSize: number, a: TArg<Uint8Array>, b: TArg<Uint8Array>) => TRet<Uint8Array>;
5
+ export declare const gf2mDouble: (blockSize: number, a: TArg<Uint8Array>) => TRet<Uint8Array>;
package/gf/index.js ADDED
@@ -0,0 +1,62 @@
1
+ import { copyBytes } from "@noble/hashes/utils.js";
2
+ const gf256Tables = /* @__PURE__ */ (() => {
3
+ const exp = new Uint8Array(510), log = new Uint8Array(256);
4
+ let x = 1;
5
+ for (let i = 0; i < 255; i++) {
6
+ exp[i] = x;
7
+ log[x] = i;
8
+ x <<= 1;
9
+ if (x & 0x100)
10
+ x ^= 0x11D;
11
+ }
12
+ for (let i = 255; i < 510; i++)
13
+ exp[i] = exp[i - 255];
14
+ return { exp, log };
15
+ })();
16
+ export const gf256Multiply = (a, b) => a === 0 || b === 0
17
+ ? 0
18
+ : gf256Tables.exp[gf256Tables.log[a] + gf256Tables.log[b]];
19
+ const POLY = [
20
+ [0x87],
21
+ [0x25, 0x04],
22
+ [0x25, 0x01]
23
+ ];
24
+ export const getGf2mReductionBytes = (blockSize) => POLY[Math.log2(blockSize) - 4];
25
+ export const gf2mMultiply = (blockSize, a, b) => {
26
+ const temp = copyBytes(a), result = new Uint8Array(blockSize), reductionBytes = getGf2mReductionBytes(blockSize);
27
+ for (let i = 0; i < blockSize * 8; i++) {
28
+ const byteIndex = Math.floor(i / 8);
29
+ const bitIndex = i % 8;
30
+ if (byteIndex < b.length && (b[byteIndex] & (1 << bitIndex)))
31
+ for (let j = 0; j < blockSize; j++)
32
+ result[j] ^= temp[j];
33
+ let carry = 0;
34
+ for (let j = 0; j < blockSize; j++) {
35
+ const nextCarry = (temp[j] & 0x80) ? 1 : 0;
36
+ temp[j] = ((temp[j] << 1) & 0xFF) | carry;
37
+ carry = nextCarry;
38
+ }
39
+ if (carry) {
40
+ for (let j = 0; j < reductionBytes.length; j++)
41
+ if (j < blockSize)
42
+ temp[j] ^= reductionBytes[j];
43
+ }
44
+ }
45
+ return result;
46
+ };
47
+ export const gf2mDouble = (blockSize, a) => {
48
+ const result = copyBytes(a);
49
+ const reductionBytes = getGf2mReductionBytes(blockSize);
50
+ let carry = 0;
51
+ for (let j = 0; j < blockSize; j++) {
52
+ const nextCarry = (result[j] & 0x80) ? 1 : 0;
53
+ result[j] = ((result[j] << 1) & 0xFF) | carry;
54
+ carry = nextCarry;
55
+ }
56
+ if (carry) {
57
+ for (let j = 0; j < reductionBytes.length; j++)
58
+ if (j < blockSize)
59
+ result[j] ^= reductionBytes[j];
60
+ }
61
+ return result;
62
+ };
@@ -0,0 +1,55 @@
1
+ import { type CHash, type TArg, type TRet } from "@noble/hashes/utils.js";
2
+ import { _HMAC } from "@noble/hashes/hmac.js";
3
+ import { HashMD } from "@noble/hashes/_md.js";
4
+ /** Internal GOST 34.311-95 hash class */
5
+ export declare class _Gost3431195 extends HashMD<_Gost3431195> {
6
+ private sbox;
7
+ private h;
8
+ private checksum;
9
+ /** Internal GOST 34.311-95 hash class */
10
+ constructor(sbox?: TArg<Uint8Array>);
11
+ protected process(view: DataView, offset?: number): void;
12
+ protected get(): number[];
13
+ protected set(...args: number[]): void;
14
+ protected roundClean(): void;
15
+ digestInto(out: TArg<Uint8Array>): void;
16
+ destroy(): void;
17
+ _cloneInto(to?: _Gost3431195): _Gost3431195;
18
+ }
19
+ /**
20
+ * GOST 34.311-95 hash function
21
+ *
22
+ * @param msg - message bytes to hash.
23
+ * @returns Digest bytes.
24
+ * @example
25
+ * ```ts
26
+ * import { gost3431195 } from "@li0ard/dstu/gost34311.js";
27
+ *
28
+ * gost3431195(new Uint8Array([97, 98, 99]));
29
+ * gost3431195.create().update(new Uint8Array([97, 98, 99])).digest();
30
+ * ```
31
+ */
32
+ export declare const gost3431195: TRet<CHash<_Gost3431195>>;
33
+ /**
34
+ * HMAC over GOST 34.311-95 hash function
35
+ *
36
+ * @param key - authentication key bytes
37
+ */
38
+ export declare class Gost3431195HMAC extends _HMAC<_Gost3431195> {
39
+ constructor(key: TArg<Uint8Array>);
40
+ }
41
+ /**
42
+ * HMAC over GOST 34.311-95 hash function
43
+ *
44
+ * @param key - authentication key bytes
45
+ * @param message - message bytes to authenticate
46
+ * @returns Authentication tag bytes.
47
+ * @example
48
+ * ```ts
49
+ * import { gost3431195Hmac } from "@li0ard/dstu/gost34311.js";
50
+ * const key = new Uint8Array([1, 2, 3]);
51
+ * const message = new Uint8Array([4, 5, 6]);
52
+ * const mac = gost3431195Hmac(key, message);
53
+ * ```
54
+ */
55
+ export declare const gost3431195Hmac: (key: TArg<Uint8Array>, msg: TArg<Uint8Array>) => TRet<Uint8Array>;
@@ -0,0 +1,167 @@
1
+ import { abytes, aexists, aoutput, clean, createHasher } from "@noble/hashes/utils.js";
2
+ import { Dstu9311, DKE_1 } from "../dstu9311/index.js";
3
+ import { numberToBytesBE } from "@noble/curves/utils.js";
4
+ import { _HMAC } from "@noble/hashes/hmac.js";
5
+ import { HashMD } from "@noble/hashes/_md.js";
6
+ const C3 = /* @__PURE__ */ new Uint8Array([
7
+ 0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff,
8
+ 0xff, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00,
9
+ 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff,
10
+ 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00
11
+ ]);
12
+ const U = /* @__PURE__ */ new Uint8Array(32), V = /* @__PURE__ */ new Uint8Array(32), W = /* @__PURE__ */ new Uint8Array(32), X = /* @__PURE__ */ new Uint8Array(32), KEY = /* @__PURE__ */ new Uint8Array(32), BLOCK = /* @__PURE__ */ new Uint8Array(32), TMP = /* @__PURE__ */ new Uint8Array(8), CT = /* @__PURE__ */ new Uint8Array(8);
13
+ const A = (x) => {
14
+ for (let i = 0; i < 8; i++)
15
+ TMP[i] = x[24 + i] ^ x[16 + i];
16
+ x.copyWithin(8, 0, 24);
17
+ x.set(TMP);
18
+ };
19
+ const chi = (y) => {
20
+ const a = y[30] ^ y[28] ^ y[26] ^ y[24] ^ y[6] ^ y[0], b = y[31] ^ y[29] ^ y[27] ^ y[25] ^ y[7] ^ y[1];
21
+ y.copyWithin(2, 0, 30);
22
+ y[0] = a;
23
+ y[1] = b;
24
+ };
25
+ const deriveKey = (u, v) => {
26
+ for (let n = 0; n < 32; n++) {
27
+ const i = 31 - (n >> 2) - ((n & 3) << 3);
28
+ KEY[n] = u[i] ^ v[i];
29
+ }
30
+ };
31
+ const encrypt = (cipher, plaintext, offset) => {
32
+ for (let i = 0; i < 8; i++)
33
+ CT[i] = plaintext[offset + 7 - i];
34
+ const e = cipher.encrypt(CT);
35
+ for (let i = 0; i < 8; i++)
36
+ X[offset + i] = e[7 - i];
37
+ };
38
+ const _step = (hin, m, sbox, out) => {
39
+ deriveKey(hin, m);
40
+ const k1 = new Dstu9311(KEY, sbox);
41
+ U.set(hin);
42
+ A(U);
43
+ V.set(m);
44
+ A(V);
45
+ A(V);
46
+ deriveKey(U, V);
47
+ const k2 = new Dstu9311(KEY, sbox);
48
+ A(U);
49
+ for (let i = 0; i < 32; i++)
50
+ U[i] ^= C3[i];
51
+ A(V);
52
+ A(V);
53
+ deriveKey(U, V);
54
+ const k3 = new Dstu9311(KEY, sbox);
55
+ A(U);
56
+ A(V);
57
+ A(V);
58
+ deriveKey(U, V);
59
+ const k4 = new Dstu9311(KEY, sbox);
60
+ encrypt(k4, hin, 0);
61
+ encrypt(k3, hin, 8);
62
+ encrypt(k2, hin, 16);
63
+ encrypt(k1, hin, 24);
64
+ for (let i = 0; i < 12; i++)
65
+ chi(X);
66
+ for (let i = 0; i < 32; i++)
67
+ W[i] = X[i] ^ m[i];
68
+ chi(W);
69
+ for (let i = 0; i < 32; i++)
70
+ X[i] = hin[i] ^ W[i];
71
+ for (let i = 0; i < 61; i++)
72
+ chi(X);
73
+ out.set(X);
74
+ };
75
+ /** Internal GOST 34.311-95 hash class */
76
+ export class _Gost3431195 extends HashMD {
77
+ sbox;
78
+ h = new Uint8Array(32);
79
+ checksum = new Uint8Array(32);
80
+ /** Internal GOST 34.311-95 hash class */
81
+ constructor(sbox = DKE_1) {
82
+ super(32, 32, 0, true);
83
+ this.sbox = sbox;
84
+ abytes(sbox, 64, "sbox");
85
+ }
86
+ process(view, offset = 0) {
87
+ let c = 0;
88
+ for (let i = 0; i < 32; i++) {
89
+ const b = view.getUint8(offset + i), s = this.checksum[i] + b + c;
90
+ this.checksum[i] = s;
91
+ c = s >> 8;
92
+ BLOCK[31 - i] = b;
93
+ }
94
+ _step(this.h, BLOCK, this.sbox, this.h);
95
+ }
96
+ // Unused
97
+ get() { return []; }
98
+ set(...args) { }
99
+ roundClean() {
100
+ clean(U, V, W, X, KEY, BLOCK, TMP, CT);
101
+ }
102
+ digestInto(out) {
103
+ aexists(this);
104
+ aoutput(out, this);
105
+ this.finished = true;
106
+ if (this.pos > 0) {
107
+ this.buffer.fill(0, this.pos);
108
+ this.process(this.view);
109
+ }
110
+ _step(this.h, numberToBytesBE(BigInt(this.length) * 8n, 32), this.sbox, this.h);
111
+ for (let i = 0; i < 32; i++)
112
+ BLOCK[i] = this.checksum[31 - i];
113
+ _step(this.h, BLOCK, this.sbox, this.h);
114
+ for (let i = 0; i < 32; i++)
115
+ out[i] = this.h[31 - i];
116
+ this.roundClean();
117
+ }
118
+ destroy() {
119
+ this.destroyed = true;
120
+ clean(this.buffer, this.h, this.checksum);
121
+ }
122
+ _cloneInto(to) {
123
+ to ||= new _Gost3431195(this.sbox);
124
+ this._cloneIntoMeta(to);
125
+ to.sbox = this.sbox;
126
+ to.h.set(this.h);
127
+ to.checksum.set(this.checksum);
128
+ return to;
129
+ }
130
+ }
131
+ /**
132
+ * GOST 34.311-95 hash function
133
+ *
134
+ * @param msg - message bytes to hash.
135
+ * @returns Digest bytes.
136
+ * @example
137
+ * ```ts
138
+ * import { gost3431195 } from "@li0ard/dstu/gost34311.js";
139
+ *
140
+ * gost3431195(new Uint8Array([97, 98, 99]));
141
+ * gost3431195.create().update(new Uint8Array([97, 98, 99])).digest();
142
+ * ```
143
+ */
144
+ export const gost3431195 = /* @__PURE__ */ createHasher(() => new _Gost3431195());
145
+ /**
146
+ * HMAC over GOST 34.311-95 hash function
147
+ *
148
+ * @param key - authentication key bytes
149
+ */
150
+ export class Gost3431195HMAC extends _HMAC {
151
+ constructor(key) { super(gost3431195, key); }
152
+ }
153
+ /**
154
+ * HMAC over GOST 34.311-95 hash function
155
+ *
156
+ * @param key - authentication key bytes
157
+ * @param message - message bytes to authenticate
158
+ * @returns Authentication tag bytes.
159
+ * @example
160
+ * ```ts
161
+ * import { gost3431195Hmac } from "@li0ard/dstu/gost34311.js";
162
+ * const key = new Uint8Array([1, 2, 3]);
163
+ * const message = new Uint8Array([4, 5, 6]);
164
+ * const mac = gost3431195Hmac(key, message);
165
+ * ```
166
+ */
167
+ export const gost3431195Hmac = (key, msg) => new Gost3431195HMAC(key).update(msg).digest();
package/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./dstu4145/index.js";
2
2
  export * from "./dstu9041/index.js";
3
3
  export * from "./dstu9311/index.js";
4
+ export * from "./gost34311/index.js";
4
5
  export { Kalyna128, Kalyna128_256, Kalyna256, Kalyna256_512, Kalyna512 } from "./kalyna/index.js";
5
6
  export * from "./kupyna/index.js";
6
7
  export * from "./modes/index.js";
package/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./dstu4145/index.js";
2
2
  export * from "./dstu9041/index.js";
3
3
  export * from "./dstu9311/index.js";
4
+ export * from "./gost34311/index.js";
4
5
  export { Kalyna128, Kalyna128_256, Kalyna256, Kalyna256_512, Kalyna512 } from "./kalyna/index.js";
5
6
  export * from "./kupyna/index.js";
6
7
  export * from "./modes/index.js";
package/iso15946.js CHANGED
@@ -7,10 +7,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { abytes, ahash } from "@noble/hashes/utils.js";
8
8
  import { AsnConvert, AsnProp, AsnPropTypes } from "@peculiar/asn1-schema";
9
9
  import { AlgorithmIdentifier } from "@peculiar/asn1-x509";
10
- import { _Gost3431195 } from "./dstu9311/hash.js";
11
- import { astring } from "@noble/curves/utils.js";
12
- const KEY_LENGTH = new Uint8Array([0, 0, 1, 0]);
13
- const COUNTER = new Uint8Array([0, 0, 0, 1]);
10
+ import { _Gost3431195 } from "./gost34311/index.js";
11
+ import { _NULL } from "./utils.js";
12
+ const KEY_LENGTH = /* @__PURE__ */ new Uint8Array([0, 0, 1, 0]), COUNTER = /* @__PURE__ */ new Uint8Array([0, 0, 0, 1]);
14
13
  class SharedInfo {
15
14
  keyInfo = new AlgorithmIdentifier();
16
15
  entityInfo;
@@ -30,7 +29,7 @@ __decorate([
30
29
  ], SharedInfo.prototype, "suppPubInfo", void 0);
31
30
  const removeLeadZeros = (bytes) => {
32
31
  const idx = bytes.findIndex(i => i !== 0);
33
- return idx === -1 ? new Uint8Array() : bytes.slice(idx);
32
+ return idx === -1 ? _NULL : bytes.slice(idx);
34
33
  };
35
34
  const encodeSharedInfo = (oid, ukm) => new Uint8Array(AsnConvert.serialize(new SharedInfo({
36
35
  keyInfo: new AlgorithmIdentifier({
@@ -43,7 +42,6 @@ const encodeSharedInfo = (oid, ukm) => new Uint8Array(AsnConvert.serialize(new S
43
42
  /** ISO/IEC 15946 KDF function */
44
43
  export const iso15946_kdf = (hash, wrapAlgoOid, inputData, ukm) => {
45
44
  ahash(hash);
46
- astring(wrapAlgoOid, "wrapAlgoOid");
47
45
  abytes(inputData, undefined, "inputData");
48
46
  if (ukm)
49
47
  abytes(ukm, undefined, "ukm");
package/kalyna/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type TArg, type TRet } from "@noble/hashes/utils.js";
2
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, table?: Readonly<TArg<BigUint64Array>[]>, sign?: 1 | -1) => bigint;
3
+ export declare const column: (x: Uint32Array, i: number, N: number, offs: ArrayLike<number>, out: Uint32Array, o: number, table?: Uint32Array[], sign?: 1 | -1) => void;
4
4
  export declare abstract class Kalyna implements Cipher {
5
5
  readonly N: number;
6
6
  /** Block size */
@@ -18,12 +18,10 @@ export declare abstract class Kalyna implements Cipher {
18
18
  private makeOddKey;
19
19
  private addkey;
20
20
  private subkey;
21
- private column;
22
- private invColumn;
23
21
  private G;
24
22
  private GL;
25
- private IMC;
26
23
  private IG;
24
+ private IMC;
27
25
  private IGL;
28
26
  /** Encrypt block */
29
27
  encrypt(block: TArg<Uint8Array>): TRet<Uint8Array>;