C# Method like Base64String, but only alphanumeric (no plus or slash)

前端 未结 6 791
清歌不尽
清歌不尽 2021-02-13 11:25

is there any C# method that works similar to Convert.ToBase64String but doesn\'t generate anything except alphanumeric output?

Thanks!

6条回答
  •  感情败类
    2021-02-13 12:01

    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.

    There's also a related discussion on StackOverflow here.

    EDIT: 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.

提交回复
热议问题