Last active
March 31, 2020 07:15
-
-
Save creationix/9024507 to your computer and use it in GitHub Desktop.
Convert a hex string (base-16) to a base-65536 (16-bit) string.
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 hexToBase65536(hex) { | |
var result = ""; | |
for (var i = hex.length ; i > 0; i -= 4) { | |
result += String.fromCharCode(parseInt(hex.substring(i - 4, i), 16)); | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hexToBase65536("a94a8fe5ccb19ba61c4c0873d391e987982fbbd3")