.NET标准2.0中的枚举HashAlgorithmType缺少Sha256,Sha384和Sha512

时间:2019-07-17 16:29:01

标签: .net-standard-2.0

我在.Net Framework 4.7.1中有一个项目,我想升级到.Net标准。我刚刚创建了一个新项目,并将所有代码复制在那里。在一个类中,我使用了HashAlgorithmType枚举。在.Net Standard中,此枚举的值为None,Md5,Sha1,Sha256,Sha384和Sha512。但是,在.Net标准项目中,库中缺少最后三个。

我已经检查了文档,在两种情况下所有六个值都应该存在。

反编译器在.Net Framework项目中显示了这一点:

namespace System.Security.Authentication
{
  /// <summary>Specifies the algorithm used for generating message authentication codes (MACs).</summary>
  [__DynamicallyInvokable]
  public enum HashAlgorithmType
  {
    /// <summary>No hashing algorithm is used.</summary>
    [__DynamicallyInvokable] None = 0,
    /// <summary>The Message Digest 5 (MD5) hashing algorithm.</summary>
    [__DynamicallyInvokable] Md5 = 32771, // 0x00008003
    /// <summary>The Secure Hashing Algorithm (SHA1).</summary>
    [__DynamicallyInvokable] Sha1 = 32772, // 0x00008004
    /// <summary>The Secure Hashing Algorithm 2 (SHA-2), using a 256-bit digest.</summary>
    Sha256 = 32780, // 0x0000800C
    /// <summary>The Secure Hashing Algorithm 2 (SHA-2), using a 384-bit digest.</summary>
    Sha384 = 32781, // 0x0000800D
    /// <summary>The Secure Hashing Algorithm 2 (SHA-2), using a 512-bit digest.</summary>
    Sha512 = 32782, // 0x0000800E
  }
}

但是在.Net标准项目中,反编译器显示如下:

namespace System.Security.Authentication
{
  /// <summary>Specifies the algorithm used for generating message authentication codes (MACs).</summary>
  public enum HashAlgorithmType
  {
    /// <summary>No hashing algorithm is used.</summary>
    /// <returns></returns>
    None = 0,
    /// <summary>The Message Digest 5 (MD5) hashing algorithm.</summary>
    /// <returns></returns>
    Md5 = 32771, // 0x00008003
    /// <summary>The Secure Hashing Algorithm (SHA1).</summary>
    /// <returns></returns>
    Sha1 = 32772, // 0x00008004
  }
}

0 个答案:

没有答案