@bsv/sdk 1.9.15 → 1.9.16

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsv/sdk",
3
- "version": "1.9.15",
3
+ "version": "1.9.16",
4
4
  "type": "module",
5
5
  "description": "BSV Blockchain Software Development Kit",
6
6
  "main": "dist/cjs/mod.js",
@@ -143,20 +143,16 @@ export function AES (input: number[], key: number[]): number[] {
143
143
  const state = [[], [], [], []]
144
144
  const output = []
145
145
 
146
- // Since the BigNumber representation of keys ignores big endian zeroes,
147
- // extend incoming key arrays with zeros to the smallest standard key size.
148
146
  const ekey = Array.from(key)
149
- if (ekey.length <= 16) {
150
- while (ekey.length < 16) ekey.unshift(0)
147
+
148
+ if (ekey.length === 16) {
151
149
  roundLimit = 11
152
- } else if (ekey.length <= 24) {
153
- while (ekey.length < 24) ekey.unshift(0)
150
+ } else if (ekey.length === 24) {
154
151
  roundLimit = 13
155
- } else if (key.length <= 32) {
156
- while (ekey.length < 32) ekey.unshift(0)
152
+ } else if (ekey.length === 32) {
157
153
  roundLimit = 15
158
154
  } else {
159
- throw new Error('Illegal key length: ' + String(key.length))
155
+ throw new Error('Illegal key length: ' + String(ekey.length))
160
156
  }
161
157
 
162
158
  const w = keyExpansion(roundLimit, ekey)