Once upon a time, in the deepest depths of a forgotten codebase, lived a developer. Let's call him... RKC.
Now, RKC was an interesting specimen. To put it bluntly, he was a bit of a dumb guy novice when it came to security. He believed that if you couldn't read it immediately, it was "encrypted."
Tasked with securing a website's admin portal, he decided to handle the password verification directly in the browser using JavaScript. He scrambled the password using the browser's native btoa() function, assuming this jumbled string of text would permanently keep intruders out.
He left the following logic behind to verify the master key:
const targetHash = "dXZtNzc1NTk4";
function authenticate(userInput) {
// btoa() securely scrambles the input text (or so he thought)
if (btoa(userInput) === targetHash) {
grantSystemAccess();
} else {
triggerAlarm();
}
}
Figure out what the function in the code does and reverse the string to deduce the original plain-text password.
Hint: The secret lies in the built-in JavaScript function the developer used. Try searching the web for:
"MDN window.btoa()"
Correct! You successfully reversed the btoa() encoding back into plain text.
Save this code for your next challenge: