arrbuf2hex
fast custom array buffer to hexadecimal string function for when you need hexadecimal numbers out of a buffer and they don't always align.
also practiacally all the functions in this are bitwise so uh it's nigh instant.
use:
const buf2hex = // 000// ff0// fff00
or
import { buf2hex } from 'arrbuf2hex'buf2hex(new ArrayBuffer(8), 0, 3, true)// 000
in the browser:
import { buf2hex } from '/node_modules/arrbuf2hex/arrbuf2hex.es'crypto.subtle.digest('SHA-1', arrbuf).then(buf2hex).then(hash => { // print hash})(async () => { const hash = buf2hex(await crypto.subtle.digest('SHA-1', new ArrayBuffer(0))) console.assert("da39a3ee5e6b4b0d3255bfef95601890afd80709" === hash, `SHA-1 invalid, zero returns ${hash} instead of da39a3ee5e6b4b0d3255bfef95601890afd80709`)})