【发布时间】:2021-02-16 11:57:53
【问题描述】:
我这里有个比较奇怪的问题,我有以下 Base64 验证器
public static bool IsBase64String(this string base64)
{
Span<byte> buffer = new Span<byte>(new byte[base64.Length]);
return Convert.TryFromBase64String(base64, buffer, out int bytesParsed);
}
然而奇怪的是,它认为下面的字符串是base64!不知道出了什么问题。
5355220565819095
我正在使用 .Net 5。
我要做什么
我需要将一个字节数组转换为 Base64 ,存储它然后能够判断它是否是 base64 然后我可以将它转换回 bytes[] 基本上是一种存储字节的有效方式!
【问题讨论】:
-
评论不用于扩展讨论;这个对话是moved to chat。
标签: c# .net cryptography console-application