Skip to content

Commit 9e5d0f7

Browse files
Merge branch 'master' of https://github.com/bsv-blockchain/ts-sdk into fix/TOB-BSV-27
2 parents a8b3263 + efdf8e7 commit 9e5d0f7

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,14 @@ All notable changes to this project will be documented in this file. The format
196196

197197
---
198198

199+
### [1.9.16] - 2025-12-01
200+
201+
### Added
202+
203+
- AES unpadding of keys.
204+
205+
---
206+
199207
### [1.9.15] - 2025-12-01
200208

201209
### Added

src/primitives/AESGCM.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,20 +143,16 @@ export function AES (input: number[], key: number[]): number[] {
143143
const state = [[], [], [], []]
144144
const output = []
145145

146-
// Since the BigNumber representation of keys ignores big endian zeroes,
147-
// extend incoming key arrays with zeros to the smallest standard key size.
148146
const ekey = Array.from(key)
149-
if (ekey.length <= 16) {
150-
while (ekey.length < 16) ekey.unshift(0)
147+
148+
if (ekey.length === 16) {
151149
roundLimit = 11
152-
} else if (ekey.length <= 24) {
153-
while (ekey.length < 24) ekey.unshift(0)
150+
} else if (ekey.length === 24) {
154151
roundLimit = 13
155-
} else if (key.length <= 32) {
156-
while (ekey.length < 32) ekey.unshift(0)
152+
} else if (ekey.length === 32) {
157153
roundLimit = 15
158154
} else {
159-
throw new Error('Illegal key length: ' + String(key.length))
155+
throw new Error('Illegal key length: ' + String(ekey.length))
160156
}
161157

162158
const w = keyExpansion(roundLimit, ekey)

0 commit comments

Comments
 (0)