jquery - Decode Base64 to Hexadecimal string with javascript -
needing convert base64 string hexadecimal javascript.
example:
var base64value = "oaaabtuaag=="
need conversion method
output (decoded data (hexadecimal)) a0000005350002
i know correct because can use website http://tomeko.net/online_tools/base64.php?lang=en
and punch in base64 string of oaaabtuaag==
, a0000005350002
what have tried?
https://github.com/carlo/jquery-base64
https://jsfiddle.net/gabrieleromanato/qaght/
i have found lot of questions
atob() charcodeat() give binary & tostring(16) give hex.
function base64tohex(base64) { var raw = atob(base64); var hex = ''; ( = 0; < raw.length; i++ ) { var _hex = raw.charcodeat(i).tostring(16) hex += (_hex.length==2?_hex:'0'+_hex); } return hex.touppercase(); } console.log(base64tohex("oaaabtuaag=="));
Comments
Post a Comment