使用缓冲区的转换不同于base64.fromarraybuffer()。为什么会发生?

发布于 2025-02-10 01:44:59 字数 887 浏览 1 评论 0原文

Tempid看起来像这样: new Uint8array([1,252,232,40,235,180,121,67,67,150,7 ,175、209、33、104、1、251、127、70、88、178、57、216、48、202、202、248、248、170、190、190、190、126、39、111、111、231、116、69 )

,133、183、59、54、1、193、110、191、48、235、14、14、172、162、113、181、147、83、90 ] 来自(tempid).toString('base64'); 返回以下内容: afzokou0euowb25jw5ywuoojvnfmtk/riwgb+39GWLI52DKOFJZQR5+J2/ndewftzs2acfzs2acfuvzdrdqyi1bwtu1bwtu1bwtu1o

0、7、110

,99、195、156、150、82、131、163、84、209、102、102、102、175、209、33、104、151、251、127、70、70、88、178、178、57、57、57、216、48、202 ,161、248、243、170、190、126、39、111、231、116、69、69、133、183、59、54、1、193、110、110、191、48、235、135、14、142、172、172、162、213 ,181,147,83,90])

base64.fromarraybuffer(predid,true); 返回以下内容:

i1bwtu1o

非常相似,但是有几个差异('='最后,'/'而不是'_'和' - ' - 而不是'+'。 为什么会发生?

TempId looks like this:
new Uint8Array([1, 252, 232, 40, 235, 180, 121, 67, 150, 7, 110, 99, 195, 156, 150, 82, 131, 163, 84, 209, 102, 76, 175, 209, 33, 104, 1, 251, 127, 70, 88, 178, 57, 216, 48, 202, 161, 248, 243, 170, 190, 126, 39, 111, 231, 116, 69, 133, 183, 59, 54, 1, 193, 110, 191, 48, 235, 14, 172, 162, 213, 181, 147, 83, 90])

Buffer.from(tempId).toString('base64'); returns this:
AfzoKOu0eUOWB25jw5yWUoOjVNFmTK/RIWgB+39GWLI52DDKofjzqr5+J2/ndEWFtzs2AcFuvzDrDqyi1bWTU1o=

CredId looks like this:

new Uint8Array([1, 252, 232, 40, 235, 180, 121, 67, 150, 7, 110, 99, 195, 156, 150, 82, 131, 163, 84, 209, 102, 76, 175, 209, 33, 104, 1, 251, 127, 70, 88, 178, 57, 216, 48, 202, 161, 248, 243, 170, 190, 126, 39, 111, 231, 116, 69, 133, 183, 59, 54, 1, 193, 110, 191, 48, 235, 14, 172, 162, 213, 181, 147, 83, 90])

base64.fromArrayBuffer(credId, true); returns this:

AfzoKOu0eUOWB25jw5yWUoOjVNFmTK_RIWgB-39GWLI52DDKofjzqr5-J2_ndEWFtzs2AcFuvzDrDqyi1bWTU1o

As you can see, the token are very similar, but there are a couple of differences ('=' at the end, '/' instead of '_', and '-' instead of '+'.
Why does that happen?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文