C#方法像Base64String,但只有字母数字(无加号或斜杠) [英] C# Method like Base64String, but only alphanumeric (no plus or slash)
问题描述
是否有任何C#方法类似于Convert.ToBase64String,但不产生任何除字母数字输出之外的任何东西?
is there any C# method that works similar to Convert.ToBase64String but doesn't generate anything except alphanumeric output?
谢谢!
推荐答案
你可能正在使用类似Base32编码的东西。有一个Base32编码器/解码器用于C#这里由Michael Giagnocavo。它使用大写字母和数字的组合。
You're probably looking at using something like Base32 encoding then. There is a Base32 encoder/decoder for C# here by Michael Giagnocavo. It uses a combination of capitalized letters and numbers.
还有一个关于StackOverflow的相关讨论 here 。
There's also a related discussion on StackOverflow here.
编辑:如果无论如何,这是针对URL安全相关的Base64编码,只是做Base64并用 - 替换+,将/替换为_。但是我猜,你可能不想要它。
And if by any chance this is for URL-safe related Base64 encoding, just do Base64 and replace "+" with "-" and "/" with "_". But I'm guessing, you may not want it for that.
这篇关于C#方法像Base64String,但只有字母数字(无加号或斜杠)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!