Question : hex to ascii converter javascript
Answered by : wild-warbler-shvh0lgsy62y
{"tags":[{"tag":"p","content":"const flag = ['0x62', '0x64', '0x61', '0x36', '0x38', '0x66', '0x37', '0x35'] "},{"tag":"p","content":"function hexToAscii(flag) { "},{"tag":"p","content":" let asciiString = ''; "},{"tag":"p","content":" for (let i = 0; i < flag.length; i++) { "},{"tag":"p","content":" let hexCharCode = flag[i]; "},{"tag":"p","content":" asciiString += String.fromCharCode(hexCharCode); "},{"tag":"p","content":" } "},{"tag":"p","content":" return asciiString; "},{"tag":"p","content":"} "},{"tag":"p","content":"console.log(hexToAscii(flag)) "}]}
Source : | Last Update : Fri, 28 Apr 23
Question : javascript ascii to hex
Answered by : hiren-reshamwala
function ascii_to_hex(str) { var arr1 = []; for (var n = 0, l = str.length; n < l; n ++) { var hex = Number(str.charCodeAt(n)).toString(16); arr1.push(hex); } return arr1.join(''); }
Source : | Last Update : Wed, 20 May 20