import { assertBytes } from "@noble/hashes/utils" ; export { assertBool , assertBytes , bytesToHex , bytesToHex as toHex , concatBytes , hexToBytes , createView , utf8ToBytes } from "@noble/hashes/utils" ; export function bytesToUtf8 ( data ) { if ( ! ( data instanceof Uint8Array ) ) { throw new TypeError ( `bytesToUtf8 expected Uint8Array, got ${ typeof data }` ) ; } return new TextDecoder ( ) . decode ( data ) ; } export function equalsBytes ( a , b ) { if ( a . length !== b . length ) { return false ; } for ( let i = 0 ; i < a . length ; i ++ ) { if ( a [ i ] !== b [ i ] ) { return false ; } } return true ; } export function wrapHash ( hash ) { return ( msg ) => { assertBytes ( msg ) ; return hash ( msg ) ; } ; } export const crypto = ( ( ) => { const webCrypto = typeof self === "object" && "crypto" in self ? self . crypto : undefined ; const nodeRequire = typeof module !== "undefined" && typeof module . require === "function" && module . require . bind ( module ) ; return { node : nodeRequire && ! webCrypto ? nodeRequire ( "crypto" ) : undefined , web : webCrypto } ; } ) ( ) ;