.net 它是什么意思,它';谁的产量?

.net 它是什么意思,它';谁的产量?,.net,encryption,.net,Encryption,有人能告诉我这是什么意思和它的输出吗?这是一个.Net脚本 private static readonly byte[] Key = { 0xda, 0x3c, 0x35, 0x6f, 0xbd, 0xd, 0x87, 0xf0, 0x9a, 0x7, 0x6d, 0xab, 0x7e, 0x82, 0x3

有人能告诉我这是什么意思和它的输出吗?这是一个.Net脚本

private static readonly byte[] Key = {
                                                0xda, 0x3c, 0x35, 0x6f, 0xbd, 0xd, 0x87, 0xf0,
                                                0x9a, 0x7, 0x6d, 0xab, 0x7e, 0x82, 0x36, 0xa,
                                                0x1a, 0x5a, 0x77, 0xfe, 0x74, 0xf3, 0x7f, 0xa8,
                                                0xaa, 0x4, 0x11, 0x46, 0x6b, 0x2d, 0x48, 0xa1
                                            };

        private static readonly byte[] IV =  {
                                                0x6d, 0x2d, 0xf5, 0x34, 0xc7, 0x60, 0xc5, 0x33,
                                                0xe2, 0xa3, 0xd7, 0xc3, 0xf3, 0x39, 0xf2, 0x16
                                            };

这些只是字节数组变量的声明和初始化,用适当的数据填充它们。因此,
Key
将是一个字节数组,其第一个元素是0xda,以此类推

变量是只读的,但这并不意味着它们是不可变的——代码仍然可以修改数组中的数据;变量是只读的,这意味着它们不能引用不同的数组


没有这样的输出-您提供的代码片段只设置了两个变量。

这些是DES加密使用的缓冲区;第一个是键,第二个是向量。下面是一个可能的加密代码:

public static string Encrypt(string data)
        {
            MemoryStream output;
            using (output = new MemoryStream())    
            {
                byte[] byteData = new UnicodeEncoding().GetBytes(data);
                TripleDESCryptoServiceProvider des = new TripleDESCryptoServiceProvider();
                using (CryptoStream cs = new CryptoStream(output, des.CreateEncryptor(Key, IV), CryptoStreamMode.Write))
                {
                    cs.Write(byteData, 0, byteData.Length);
                }
            }
            return Convert.ToBase64String(output.ToArray());
        }

关于加密你是对的,但这不是DES。根据密钥大小(256位)和块大小(128位),它可能是AES-256。