小编L.A*_*ham的帖子

如何在 C# 中将字符串转换为位

我正在开发一个使用位置交换对文本进行加密的项目。我已经使用字符位置交换 { Hello -> elloH} 完成了该项目,现在我正在研究位位置交换。我使用相同的算法来加密这些位,但问题是如何将结果位改回字符串?

注意:不能使用BitArray。

这是我现在所拥有的:

static byte[] toByteArray(string s)
    {
        byte[] arr = new System.Text.UTF8Encoding(true).GetBytes(s);
        return arr;
    }// Byte Array must be changed to bits.
 private void button1_Click(object sender, EventArgs e)
{
        String[] X = new String[x.Length];// Will Contain the Encoded Bits
        for(int i=0;i<x.Length;i++)
        {
            X[i] = Convert.ToString(x[i], 2);
            textBox3.Text += X[i];
        }
}
Run Code Online (Sandbox Code Playgroud)

c# string encryption

1
推荐指数
1
解决办法
6544
查看次数

标签 统计

c# ×1

encryption ×1

string ×1