We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
arrayToHexString
1 parent 83f0f45 commit feae780Copy full SHA for feae780
lib/utils.ts
@@ -54,12 +54,10 @@ export const hexStringToArray = (hex: string) => {
54
* @returns Hexadecimal representation of the array
55
*/
56
export const arrayToHexString = (bytes: Uint8Array) => {
57
- const res = [];
58
- for (let c = 0; c < bytes.length; c++) {
59
- const hex = bytes[c].toString(16);
60
- res.push(hex.length < 2 ? '0' + hex : hex);
61
- }
62
- return res.join('');
+ const hexAlphabet = '0123456789abcdef';
+ let s = '';
+ bytes.forEach((v) => { s += hexAlphabet[v >> 4] + hexAlphabet[v & 15]; });
+ return s;
63
};
64
65
/**
0 commit comments