utils: copy concatBytes from hashes

This commit is contained in:
Paul Miller 2024-01-02 07:49:40 +00:00
parent 37eab5a28a
commit 7be1dfc55d
No known key found for this signature in database
GPG Key ID: 697079DA6878B89B

@ -141,9 +141,8 @@ export function concatBytes(...arrays: Uint8Array[]): Uint8Array {
if (!isBytes(a)) throw new Error('Uint8Array expected');
sum += a.length;
}
let res = new Uint8Array(sum);
let pad = 0;
for (let i = 0; i < arrays.length; i++) {
const res = new Uint8Array(sum);
for (let i = 0, pad = 0; i < arrays.length; i++) {
const a = arrays[i];
res.set(a, pad);
pad += a.length;