Last active
April 11, 2016 02:25
-
-
Save ojame/c36699aeab3c8c0c509e747e6609c0f1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var input = '49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d'; | |
var result = 'SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t'; | |
function hexToPT(hex) { | |
var str = ''; | |
for (var i = 0; i < hex.length; i += 2) { | |
str += String.fromCharCode(parseInt(hex.substr(i, 2), 16)); | |
} | |
return str; | |
} | |
var converted = window.btoa(hexToPT(input)); | |
console.log(converted === result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment