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

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

  • <tfoot id='iJ7tb'></tfoot>

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

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

        <bdo id='iJ7tb'></bdo><ul id='iJ7tb'></ul>
      1. Rfc2898/PBKDF2 與 SHA256 作為 C# 中的摘要

        Rfc2898 / PBKDF2 with SHA256 as digest in c#(Rfc2898/PBKDF2 與 SHA256 作為 C# 中的摘要)

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

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

                    <tbody id='sr2wi'></tbody>
                1. 本文介紹了Rfc2898/PBKDF2 與 SHA256 作為 C# 中的摘要的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我想在 c# 中使用 Rfc2898 來派生密鑰.我還需要使用 SHA256 作為 Rfc2898 的摘要.我找到了類 Rfc2898DeriveBytes,但它使用 SHA-1,我看不出有辦法讓它使用不同的摘要.

                  I want to use Rfc2898 in c# to derive a key. I also need to use SHA256 as Digest for Rfc2898. I found the class Rfc2898DeriveBytes, but it uses SHA-1 and I don't see a way to make it use a different digest.

                  有沒有辦法在 c# 中使用 Rfc2898 和 SHA256 作為摘要(沒有從頭開始實現它)?

                  Is there a way to use Rfc2898 in c# with SHA256 as digest (short of implementing it from scratch)?

                  推薦答案

                  查看 Bruno Garcia 的回答.

                  See Bruno Garcia's answer.

                  Carsten:請接受那個答案而不是這個答案.

                  Carsten: Please accept that answer rather than this one.

                  在我開始回答這個問題時,Rfc2898DeriveBytes 無法配置為使用不同的哈希函數.但與此同時,它也得到了改進.見布魯諾加西亞的回答.以下函數可用于生成用戶提供的密碼的哈希版本,以存儲在數據庫中用于身份驗證.

                  At the time I started this answer, Rfc2898DeriveBytes was not configurable to use a different hash function. In the meantime, though, it has been improved; see Bruno Garcia's answer. The following function can be used to generate a hashed version of a user-provided password to store in a database for authentication purposes.

                  對于舊 .NET 框架的用戶,這仍然很有用:

                  For users of older .NET frameworks, this is still useful:

                  // NOTE: The iteration count should
                  // be as high as possible without causing
                  // unreasonable delay.  Note also that the password
                  // and salt are byte arrays, not strings.  After use,
                  // the password and salt should be cleared (with Array.Clear)
                  
                  public static byte[] PBKDF2Sha256GetBytes(int dklen, byte[] password, byte[] salt, int iterationCount){
                      using(var hmac=new System.Security.Cryptography.HMACSHA256(password)){
                          int hashLength=hmac.HashSize/8;
                          if((hmac.HashSize&7)!=0)
                              hashLength++;
                          int keyLength=dklen/hashLength;
                          if((long)dklen>(0xFFFFFFFFL*hashLength) || dklen<0)
                              throw new ArgumentOutOfRangeException("dklen");
                          if(dklen%hashLength!=0)
                              keyLength++;
                          byte[] extendedkey=new byte[salt.Length+4];
                          Buffer.BlockCopy(salt,0,extendedkey,0,salt.Length);
                          using(var ms=new System.IO.MemoryStream()){
                              for(int i=0;i<keyLength;i++){
                                  extendedkey[salt.Length]=(byte)(((i+1)>>24)&0xFF);
                                  extendedkey[salt.Length+1]=(byte)(((i+1)>>16)&0xFF);
                                  extendedkey[salt.Length+2]=(byte)(((i+1)>>8)&0xFF);
                                  extendedkey[salt.Length+3]=(byte)(((i+1))&0xFF);
                                  byte[] u=hmac.ComputeHash(extendedkey);
                                  Array.Clear(extendedkey,salt.Length,4);
                                  byte[] f=u;
                                  for(int j=1;j<iterationCount;j++){
                                      u=hmac.ComputeHash(u);
                                      for(int k=0;k<f.Length;k++){
                                          f[k]^=u[k];
                                      }
                                  }
                                  ms.Write(f,0,f.Length);
                                  Array.Clear(u,0,u.Length);
                                  Array.Clear(f,0,f.Length);
                              }
                              byte[] dk=new byte[dklen];
                              ms.Position=0;
                              ms.Read(dk,0,dklen);
                              ms.Position=0;
                              for(long i=0;i<ms.Length;i++){
                                  ms.WriteByte(0);
                              }
                              Array.Clear(extendedkey,0,extendedkey.Length);
                              return dk;
                          }
                      }
                  

                  這篇關于Rfc2898/PBKDF2 與 SHA256 作為 C# 中的摘要的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

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

                            <tbody id='q3qId'></tbody>

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

                          • <bdo id='q3qId'></bdo><ul id='q3qId'></ul>
                            <tfoot id='q3qId'></tfoot>
                            主站蜘蛛池模板: 日韩高清成人 | 在线观看国产精品视频 | 99re在线视频免费观看 | 日韩在线视频一区 | av电影一区二区 | 国产精品成人在线观看 | 天堂一区| 日本视频免费 | 欧美日韩亚洲一区 | 国产一区二区三区四区 | 国产综合在线视频 | 国产乱码精品1区2区3区 | 一区二区三区免费观看 | 国产精品久久久久久吹潮 | 超碰在线人人干 | 国产成人精品久久二区二区91 | 国产1页 | 亚洲精品亚洲人成人网 | www.色综合| 久久av一区二区三区 | 国产精品一区二区三区在线播放 | 一区精品视频在线观看 | 国产午夜高清 | 亚洲国产成人在线观看 | 日韩免费视频 | 久久男人 | 国产精品一级 | 美女操网站 | 午夜视频免费 | 久草www | 亚洲人成人一区二区在线观看 | 91看片在线 | 毛片毛片毛片毛片毛片 | 国产乱码精品一区二区三区av | 成人免费观看男女羞羞视频 | 久久99精品久久久久蜜桃tv | 久久久久久久亚洲精品 | 999精品在线观看 | 色在线视频网站 | 久久综合一区 | 久久久久91 |