Skip to content

Instantly share code, notes, and snippets.

@creationix
Last active March 31, 2020 07:15
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save creationix/9024507 to your computer and use it in GitHub Desktop.
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.
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;
}
@roflmoqkz
Copy link

hexToBase65536("a94a8fe5ccb19ba61c4c0873d391e987982fbbd3")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment