Skip to content

Commit

Permalink
feat: add equalBytes utility function
Browse files Browse the repository at this point in the history
  • Loading branch information
nugaon committed Mar 16, 2022
1 parent aca15c1 commit 1208b01
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,9 @@ export function bytesToHex<Length extends number>(bytes: Uint8Array, len: Length

return hex
}

export function equalBytes(a: Uint8Array, b: Uint8Array): boolean {
if (a.length !== b.length) return false

return a.every((byte, index) => b[index] === byte)
}

0 comments on commit 1208b01

Please sign in to comment.