>>101479939
this is part of a pre application programming question. how does one solve this?:
{
challenger: 'bob',
encrypted_path: 'task_504db5ae8b1b0fb55bf72a188e6422bd',
encryption_method: 'encoded it with custom hex character set d86e5cf942730b1a',
expires_in: '1s',
hint: 'you should write a program to fetch these endpoints and handle each encryption method you find.',
instructions: "we've been alerted that you reached level 4, keep going!",
level: 4
}
I tried this js function written by gpt but it dont work:
function decryptCustomHex(encryptedString, customHexSet) {
// Step 1: Create a mapping from custom hex to standard hex
const standardHex = '0123456789abcdef';
const hexMap = {};
for (let i = 0; i < 16; i++) {
hexMap[customHexSet[i]] = standardHex[i];
}
// Step 2: Convert from custom hex to standard hex
const standardHexString = encryptedString
.toLowerCase()
.split('')
.map(char => hexMap[char])
.join('');
// Step 3: Convert from hex to bytes
const byteArray = [];
for (let i = 0; i < standardHexString.length; i += 2) {
byteArray.push(parseInt(standardHexString.substr(i, 2), 16));
}
// Step 4: Decrypt the bytes (if necessary)
// If there's no additional encryption, skip this step
// const decryptedBytes = someDecryptionFunction(byteArray);
// Step 5: Convert bytes to string
const decryptedString = String.fromCharCode.apply(null, byteArray);
return decryptedString;
}