久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<tfoot id='eiA0V'></tfoot>

      <bdo id='eiA0V'></bdo><ul id='eiA0V'></ul>
  • <i id='eiA0V'><tr id='eiA0V'><dt id='eiA0V'><q id='eiA0V'><span id='eiA0V'><b id='eiA0V'><form id='eiA0V'><ins id='eiA0V'></ins><ul id='eiA0V'></ul><sub id='eiA0V'></sub></form><legend id='eiA0V'></legend><bdo id='eiA0V'><pre id='eiA0V'><center id='eiA0V'></center></pre></bdo></b><th id='eiA0V'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='eiA0V'><tfoot id='eiA0V'></tfoot><dl id='eiA0V'><fieldset id='eiA0V'></fieldset></dl></div>
  • <legend id='eiA0V'><style id='eiA0V'><dir id='eiA0V'><q id='eiA0V'></q></dir></style></legend>

        <small id='eiA0V'></small><noframes id='eiA0V'>

        如何使用“System.Security.Cryptography.AesManaged"加

        How to use #39;System.Security.Cryptography.AesManaged#39; to encrypt a byte[]?(如何使用“System.Security.Cryptography.AesManaged加密一個(gè)字節(jié)[]?)
          <bdo id='oBzQC'></bdo><ul id='oBzQC'></ul>

            <legend id='oBzQC'><style id='oBzQC'><dir id='oBzQC'><q id='oBzQC'></q></dir></style></legend>

            • <i id='oBzQC'><tr id='oBzQC'><dt id='oBzQC'><q id='oBzQC'><span id='oBzQC'><b id='oBzQC'><form id='oBzQC'><ins id='oBzQC'></ins><ul id='oBzQC'></ul><sub id='oBzQC'></sub></form><legend id='oBzQC'></legend><bdo id='oBzQC'><pre id='oBzQC'><center id='oBzQC'></center></pre></bdo></b><th id='oBzQC'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='oBzQC'><tfoot id='oBzQC'></tfoot><dl id='oBzQC'><fieldset id='oBzQC'></fieldset></dl></div>
              <tfoot id='oBzQC'></tfoot>

                <small id='oBzQC'></small><noframes id='oBzQC'>

                  <tbody id='oBzQC'></tbody>
                  本文介紹了如何使用“System.Security.Cryptography.AesManaged"加密一個(gè)字節(jié)[]?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  限時(shí)送ChatGPT賬號(hào)..

                  基本上我想使用 System.Security.Cryptography.AesManaged (或者更好的類,如果你認(rèn)為有的話?)獲取一個(gè)字節(jié)數(shù)組并使用給定的對(duì)稱密鑰創(chuàng)建另一個(gè)加密字節(jié)數(shù)組(我假設(shè)我需要一個(gè)嗎?).

                  Basically i want to use System.Security.Cryptography.AesManaged (or a better class, if you think there is one?) to take one byte array and create another encrypted byte array, using a given symmetric key (i assume i'll need one?).

                  我還需要逆向這個(gè)過(guò)程的方法.

                  I also will need the way to reverse this procedure.

                  這樣做的目的是讓我可以加密存儲(chǔ)的密碼.我認(rèn)為有一種簡(jiǎn)單的方法可以做到這一點(diǎn)?

                  The point of this is so i can encrypt stored passwords. I assume there's a simple way to do this?

                  謝謝

                  推薦答案

                  你真的應(yīng)該在每次加密時(shí)生成一個(gè)隨機(jī) IV,不像我下面的古老代碼:

                  You really should generate a random IV each time you encrypt, unlike my ancient code below:

                  這是我最后所做的,靈感來(lái)自(舊版)邁克爾的回答:

                  Here's what i did in the end, inspired by (an older version of) michael's answer:

                  private string Encrypt(string input)
                  {
                    return Convert.ToBase64String(Encrypt(Encoding.UTF8.GetBytes(input)));
                  }
                  private byte[] Encrypt(byte[] input)
                  {
                    PasswordDeriveBytes pdb = new PasswordDeriveBytes("hjiweykaksd", new byte[] { 0x43, 0x87, 0x23, 0x72, 0x45, 0x56, 0x68, 0x14, 0x62, 0x84 });
                    MemoryStream ms = new MemoryStream();
                    Aes aes = new AesManaged();
                    aes.Key = pdb.GetBytes(aes.KeySize / 8);
                    aes.IV = pdb.GetBytes(aes.BlockSize / 8);
                    CryptoStream cs = new CryptoStream(ms, aes.CreateEncryptor(), CryptoStreamMode.Write);
                    cs.Write(input, 0, input.Length);
                    cs.Close();
                    return ms.ToArray();
                  }
                  private string Decrypt(string input)
                  {
                    return Encoding.UTF8.GetString(Decrypt(Convert.FromBase64String(input)));
                  }
                  private byte[] Decrypt(byte[] input)
                  {
                    PasswordDeriveBytes pdb = new PasswordDeriveBytes("hjiweykaksd", new byte[] { 0x43, 0x87, 0x23, 0x72, 0x45, 0x56, 0x68, 0x14, 0x62, 0x84 });
                    MemoryStream ms = new MemoryStream();
                    Aes aes = new AesManaged();
                    aes.Key = pdb.GetBytes(aes.KeySize / 8);
                    aes.IV = pdb.GetBytes(aes.BlockSize / 8);
                    CryptoStream cs = new CryptoStream(ms, aes.CreateDecryptor(), CryptoStreamMode.Write);
                    cs.Write(input, 0, input.Length);
                    cs.Close();
                    return ms.ToArray();
                  }
                  

                  這篇關(guān)于如何使用“System.Security.Cryptography.AesManaged"加密一個(gè)字節(jié)[]?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  What are good algorithms for vehicle license plate detection?(車(chē)牌檢測(cè)有哪些好的算法?)
                  onClick event for Image in Unity(Unity中圖像的onClick事件)
                  Running Total C#(運(yùn)行總 C#)
                  Deleting a directory when clicked on a hyperlink with JAvascript.ASP.NET C#(單擊帶有 JAvascript.ASP.NET C# 的超鏈接時(shí)刪除目錄)
                  asp.net listview highlight row on click(asp.net listview 在單擊時(shí)突出顯示行)
                  Calling A Button OnClick from a function(從函數(shù)調(diào)用按鈕 OnClick)

                • <small id='LZyHJ'></small><noframes id='LZyHJ'>

                      <i id='LZyHJ'><tr id='LZyHJ'><dt id='LZyHJ'><q id='LZyHJ'><span id='LZyHJ'><b id='LZyHJ'><form id='LZyHJ'><ins id='LZyHJ'></ins><ul id='LZyHJ'></ul><sub id='LZyHJ'></sub></form><legend id='LZyHJ'></legend><bdo id='LZyHJ'><pre id='LZyHJ'><center id='LZyHJ'></center></pre></bdo></b><th id='LZyHJ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='LZyHJ'><tfoot id='LZyHJ'></tfoot><dl id='LZyHJ'><fieldset id='LZyHJ'></fieldset></dl></div>
                        <bdo id='LZyHJ'></bdo><ul id='LZyHJ'></ul>
                        1. <legend id='LZyHJ'><style id='LZyHJ'><dir id='LZyHJ'><q id='LZyHJ'></q></dir></style></legend>
                              <tbody id='LZyHJ'></tbody>

                            <tfoot id='LZyHJ'></tfoot>

                            主站蜘蛛池模板: 欧美a级成人淫片免费看 | 亚洲精品日韩在线 | 中文字幕1区 | 51ⅴ精品国产91久久久久久 | 91原创视频在线观看 | 在线伊人网 | 久久久综合久久 | 国产精品精品 | 亚洲国产黄色av | 午夜在线视频一区二区三区 | 国产福利资源在线 | 在线a视频网站 | 欧美在线亚洲 | 久久在视频 | 日韩在线成人 | 福利久久| 粉嫩一区二区三区国产精品 | 欧美久久天堂 | 国产精品久久久久久久久久三级 | 成人在线播放网站 | 日韩国产一区二区 | 毛片在线视频 | 日韩免费高清视频 | 国产亚洲一区二区三区 | 日韩二三区 | 国产成人精品免费视频大全最热 | 日韩黄a | 日韩精品视频中文字幕 | 黄色中文字幕 | 亚洲成人精品免费 | 亚洲人成网站777色婷婷 | 久久er99热精品一区二区 | 色婷婷精品国产一区二区三区 | 免费永久av | 国产精品美女 | 日一区二区 | 狠狠的干| 毛片com | 国产欧美综合在线 | 亚洲精品国产电影 | 日日操操 |