[英]Byte[32] converts to string with Convert.ToBase64String(byteValue32) but to go opposite the Encoding.ASCII.GetBytes(string) becomes byte[44]
所以看起來轉換不一樣
例
byte[] salt; // this i hover over and see {byte[32]}
string saltText = Convert.ToBase64String(salt);
// This saltText come out with the string
// example is that saltText = puYwD1RHO9mdrg4eakJIskcrN4wPlxzkBwjdwyJL+Eg=
這部分很好,但是我需要將其轉換回來,所以我做到了
byte[] saltArray = Encoding.ASCII.GetBytes(saltText);
// Hover over and the saltArray is saying {byte[44]}
我不了解字節嗎? 為什么從32變為44 ?
試試這個解碼
var base64EncodedBytes = System.Convert.FromBase64String(salt);
var stringData = System.Text.Encoding.UTF8.GetString(base64EncodedBytes);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.