<small id='LCyLK'></small><noframes id='LCyLK'>

<legend id='LCyLK'><style id='LCyLK'><dir id='LCyLK'><q id='LCyLK'></q></dir></style></legend>
<i id='LCyLK'><tr id='LCyLK'><dt id='LCyLK'><q id='LCyLK'><span id='LCyLK'><b id='LCyLK'><form id='LCyLK'><ins id='LCyLK'></ins><ul id='LCyLK'></ul><sub id='LCyLK'></sub></form><legend id='LCyLK'></legend><bdo id='LCyLK'><pre id='LCyLK'><center id='LCyLK'></center></pre></bdo></b><th id='LCyLK'></th></span></q></dt></tr></i><div id='LCyLK'><tfoot id='LCyLK'></tfoot><dl id='LCyLK'><fieldset id='LCyLK'></fieldset></dl></div>
  • <tfoot id='LCyLK'></tfoot>

          <bdo id='LCyLK'></bdo><ul id='LCyLK'></ul>
      1. 使用 javascript 将 Base64 解码为十六进制字符串

        Decode Base64 to Hexadecimal string with javascript(使用 javascript 将 Base64 解码为十六进制字符串)

        <small id='Xgrr0'></small><noframes id='Xgrr0'>

          1. <legend id='Xgrr0'><style id='Xgrr0'><dir id='Xgrr0'><q id='Xgrr0'></q></dir></style></legend>
              <tbody id='Xgrr0'></tbody>
          2. <i id='Xgrr0'><tr id='Xgrr0'><dt id='Xgrr0'><q id='Xgrr0'><span id='Xgrr0'><b id='Xgrr0'><form id='Xgrr0'><ins id='Xgrr0'></ins><ul id='Xgrr0'></ul><sub id='Xgrr0'></sub></form><legend id='Xgrr0'></legend><bdo id='Xgrr0'><pre id='Xgrr0'><center id='Xgrr0'></center></pre></bdo></b><th id='Xgrr0'></th></span></q></dt></tr></i><div id='Xgrr0'><tfoot id='Xgrr0'></tfoot><dl id='Xgrr0'><fieldset id='Xgrr0'></fieldset></dl></div>

              1. <tfoot id='Xgrr0'></tfoot>
                • <bdo id='Xgrr0'></bdo><ul id='Xgrr0'></ul>
                  本文介绍了使用 javascript 将 Base64 解码为十六进制字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  需要使用 javascript 将 Base64 字符串转换为十六进制.

                  Needing to convert a Base64 string to Hexadecimal with javascript.

                  例子:

                  var base64Value = "oAAABTUAAg=="
                  

                  需要转换方法

                  输出(解码数据(十六进制))A0000005350002

                  Output (Decoded data (hexadecimal)) A0000005350002

                  我知道这是正确的,因为我可以使用这个网站 http://tomeko.net/online_tools/base64.php?lang=en

                  I know this is correct because I can use this website http://tomeko.net/online_tools/base64.php?lang=en

                  输入oAAABTUAAg==的Base64字符串,得到A0000005350002

                  and punch in Base64 string of oAAABTUAAg== and get A0000005350002

                  我尝试了什么?

                  https://github.com/carlo/jquery-base64
                  https://jsfiddle.net/gabrieleromanato/qaght/

                  我发现了很多问题

                  推荐答案

                  atob() 然后 charCodeAt() 会给你二进制 &toString(16) 会给你十六进制.

                  atob() then charCodeAt() will give you binary & toString(16) will give you hex.

                  function base64ToHex(str) {
                    const raw = atob(str);
                    let result = '';
                    for (let i = 0; i < raw.length; i++) {
                      const hex = raw.charCodeAt(i).toString(16);
                      result += (hex.length === 2 ? hex : '0' + hex);
                    }
                    return result.toUpperCase();
                  }
                  
                  console.log(base64ToHex("oAAABTUAAg=="));

                  这篇关于使用 javascript 将 Base64 解码为十六进制字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                  问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                  Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                  CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                  Ordinals in words javascript(javascript中的序数)
                  getFullYear returns year before on first day of year(getFullYear 在一年的第一天返回前一年)
                    <legend id='CzA4a'><style id='CzA4a'><dir id='CzA4a'><q id='CzA4a'></q></dir></style></legend>
                      <tbody id='CzA4a'></tbody>

                    <small id='CzA4a'></small><noframes id='CzA4a'>

                      <tfoot id='CzA4a'></tfoot>

                        <i id='CzA4a'><tr id='CzA4a'><dt id='CzA4a'><q id='CzA4a'><span id='CzA4a'><b id='CzA4a'><form id='CzA4a'><ins id='CzA4a'></ins><ul id='CzA4a'></ul><sub id='CzA4a'></sub></form><legend id='CzA4a'></legend><bdo id='CzA4a'><pre id='CzA4a'><center id='CzA4a'></center></pre></bdo></b><th id='CzA4a'></th></span></q></dt></tr></i><div id='CzA4a'><tfoot id='CzA4a'></tfoot><dl id='CzA4a'><fieldset id='CzA4a'></fieldset></dl></div>
                          • <bdo id='CzA4a'></bdo><ul id='CzA4a'></ul>