File tree 1 file changed +6
-1
lines changed
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 1
1
// buf.toString('hex') -> toHex(buf)
2
2
import assert from "@noble/hashes/_assert" ;
3
+ import { hexToBytes as _hexToBytes } from "@noble/hashes/utils" ;
3
4
const assertBool = assert . bool ;
4
5
const assertBytes = assert . bytes ;
5
6
export { assertBool , assertBytes } ;
6
7
export {
7
8
bytesToHex ,
8
9
bytesToHex as toHex ,
9
10
concatBytes ,
10
- hexToBytes ,
11
11
createView ,
12
12
utf8ToBytes
13
13
} from "@noble/hashes/utils" ;
@@ -20,6 +20,11 @@ export function bytesToUtf8(data: Uint8Array): string {
20
20
return new TextDecoder ( ) . decode ( data ) ;
21
21
}
22
22
23
+ export function hexToBytes ( data : string ) : Uint8Array {
24
+ const sliced = data . startsWith ( "0x" ) ? data . substring ( 2 ) : data ;
25
+ return _hexToBytes ( sliced ) ;
26
+ }
27
+
23
28
// buf.equals(buf2) -> equalsBytes(buf, buf2)
24
29
export function equalsBytes ( a : Uint8Array , b : Uint8Array ) : boolean {
25
30
if ( a . length !== b . length ) {
You can’t perform that action at this time.
0 commit comments