string pwd = "123456"; //字符串 ToBase64 byte[] bytes = Encoding.Default.GetBytes(pwd); pwd = Convert.ToBase64String(bytes); //字符串分割反转。 var strs = pwd.ToCharArray().Reverse<char>(); pwd = string.Join("",strs ); //合并字符串 strs = pwd.ToCharArray().Reverse<char>(); pwd = string.Join("", strs); //字符串 FromBase64 byte[] outputb = Convert.FromBase64String(pwd); pwd = Encoding.Default.GetString(outputb);
纸上得来终觉浅,绝知此事要躬行。