File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 11// buf.toString('hex') -> toHex(buf)
22import assert from "@noble/hashes/_assert" ;
3+ import { hexToBytes as _hexToBytes } from "@noble/hashes/utils" ;
34const assertBool = assert . bool ;
45const assertBytes = assert . bytes ;
56export { assertBool , assertBytes } ;
67export {
78 bytesToHex ,
89 bytesToHex as toHex ,
910 concatBytes ,
10- hexToBytes ,
1111 createView ,
1212 utf8ToBytes
1313} from "@noble/hashes/utils" ;
@@ -20,6 +20,11 @@ export function bytesToUtf8(data: Uint8Array): string {
2020 return new TextDecoder ( ) . decode ( data ) ;
2121}
2222
23+ export function hexToBytes ( data : string ) : Uint8Array {
24+ const sliced = data . startsWith ( "0x" ) ? data . substring ( 2 ) : data ;
25+ return _hexToBytes ( sliced ) ;
26+ }
27+
2328// buf.equals(buf2) -> equalsBytes(buf, buf2)
2429export function equalsBytes ( a : Uint8Array , b : Uint8Array ) : boolean {
2530 if ( a . length !== b . length ) {
You can’t perform that action at this time.
0 commit comments