Skip to content

Commit

Permalink
utils: copy concatBytes from hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Jan 2, 2024
1 parent 37eab5a commit 7be1dfc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/abstract/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7be1dfc

Please sign in to comment.