mscorlib(4.0.0.0) API with additions
HashAlgorithmName.cs
2 {
4  public struct HashAlgorithmName : IEquatable<HashAlgorithmName>
5  {
6  private readonly string _name;
7 
10  public static HashAlgorithmName MD5 => new HashAlgorithmName("MD5");
11 
14  public static HashAlgorithmName SHA1 => new HashAlgorithmName("SHA1");
15 
18  public static HashAlgorithmName SHA256 => new HashAlgorithmName("SHA256");
19 
22  public static HashAlgorithmName SHA384 => new HashAlgorithmName("SHA384");
23 
26  public static HashAlgorithmName SHA512 => new HashAlgorithmName("SHA512");
27 
30  public string Name => _name;
31 
34  public HashAlgorithmName(string name)
35  {
36  _name = name;
37  }
38 
41  public override string ToString()
42  {
43  return _name ?? string.Empty;
44  }
45 
50  public override bool Equals(object obj)
51  {
52  if (obj is HashAlgorithmName)
53  {
54  return Equals((HashAlgorithmName)obj);
55  }
56  return false;
57  }
58 
63  public bool Equals(HashAlgorithmName other)
64  {
65  return _name == other._name;
66  }
67 
70  public override int GetHashCode()
71  {
72  if (_name != null)
73  {
74  return _name.GetHashCode();
75  }
76  return 0;
77  }
78 
84  public static bool operator ==(HashAlgorithmName left, HashAlgorithmName right)
85  {
86  return left.Equals(right);
87  }
88 
94  public static bool operator !=(HashAlgorithmName left, HashAlgorithmName right)
95  {
96  return !(left == right);
97  }
98  }
99 }
Computes the T:System.Security.Cryptography.SHA384 hash for the input data.
Definition: SHA384.cs:7
Computes the T:System.Security.Cryptography.SHA256 hash for the input data.
Definition: SHA256.cs:7
bool Equals(HashAlgorithmName other)
Returns a value that indicates whether two T:System.Security.Cryptography.HashAlgorithmName instances...
string Name
Gets the underlying string representation of the algorithm name.
HashAlgorithmName(string name)
Initializes a new instance of the T:System.Security.Cryptography.HashAlgorithmName structure with a c...
Represents the abstract class from which all implementations of the T:System.Security....
Definition: MD5.cs:7
Computes the T:System.Security.Cryptography.SHA512 hash for the input data.
Definition: SHA512.cs:7
override bool Equals(object obj)
Returns a value that indicates whether the current instance and a specified object are equal.
Specifies the name of a cryptographic hash algorithm.
static bool operator==(HashAlgorithmName left, HashAlgorithmName right)
Determines whether two specified T:System.Security.Cryptography.HashAlgorithmName objects are equal.
override string ToString()
Returns the string representation of the current T:System.Security.Cryptography.HashAlgorithmName ins...
override int GetHashCode()
Returns the hash code for the current instance.
static bool operator !=(HashAlgorithmName left, HashAlgorithmName right)
Determines whether two specified T:System.Security.Cryptography.HashAlgorithmName objects are not equ...
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition: IEquatable.cs:6
Computes the T:System.Security.Cryptography.SHA1 hash for the input data.
Definition: SHA1.cs:7