-
-
Save Gamalalegende/db85f27e3e7bf496f8a9385721e73702 to your computer and use it in GitHub Desktop.
Password decryption for Hack This Site's basic level 6.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function decrypt(password) { | |
var letters = 'abcdefghijklmnopqrstuvwxyz', | |
decrypt = ''; | |
for (var x = 0; x < password.length; x++) { | |
var value = password[x]; | |
if (isNaN(value)) decrypt += letters[letters.indexOf(value) - x]; | |
else decrypt += value - x; | |
} | |
return decrypt; | |
} | |
decrypt(['a', 5, 'h', 7, 7, 9, 'i', 'h']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment