EasyPythonJavaScriptTypeScript

Hex Encode Bytes

Node.jsBuffersStrings

Convert an array of bytes (0–255) into a lowercase hex string.

solve([255, 16, 0])'ff1000'. Pad each byte to 2 hex chars.

Sample tests

Test #1Single byte 255
Input: [[255]]
Output: "ff"
Test #2No padding needed
Input: [[16,32,48]]
Output: "102030"
Test #3Padding leading zeros
Input: [[0,1,2]]
Output: "000102"
Test #4abcdef
Input: [[171,205,239]]
Output: "abcdef"
Test #5Empty input
Input: [[]]
Output: ""