为什么一个base64连接codeD字符串必须在最后一个等号(=) [英] Why does a base64 encoded string have an = sign at the end

查看:2086
本文介绍了为什么一个base64连接codeD字符串必须在最后一个等号(=)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道什么是的base64 编码是如何计算的base64 在C#编码,但我见过好几次当我将一个字符串转换的base64,有一个 = 结尾。

的几个问题提出了:


  1. 难道一个的base64 字符串总是与 = 结束?

  2. 为什么一个 = 末得到追加?


解决方案

它作为填充

一个更完整的答案是,一个base64连接codeD字符串不的总是的有端 = ,它只会结束被一个或两个 = 如果它们需要垫串输出到适当的长度。

I know what base64 encoding is and how to calculate base64 encoding in C#, however I have seen several times that when I convert a string into base64, there is an = at the end.

A few questions came up:

  1. Does a base64 string always end with =?
  2. Why does an = get appended at the end?

解决方案

It serves as padding.

A more complete answer is that a base64 encoded string doesn't always end with a =, it will only end with one or two = if they are required to pad the string out to the proper length.

这篇关于为什么一个base64连接codeD字符串必须在最后一个等号(=)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆