File tree Expand file tree Collapse file tree 3 files changed +15
-4
lines changed
src/System/Security/Cryptography
tests/System/Security/Cryptography
System.Security.Cryptography/ref Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -118,14 +118,17 @@ private MLKemAlgorithm(
118118 /// <see langword="true" /> if the objects are considered equal; otherwise, <see langword="false" />.
119119 /// </returns>
120120 // This is a closed type, so all we need to compare are the names.
121- public bool Equals ( MLKemAlgorithm ? other ) => other is not null && other . Name == Name ;
121+ public bool Equals ( [ NotNullWhen ( true ) ] MLKemAlgorithm ? other ) => other is not null && other . Name == Name ;
122122
123123 /// <inheritdoc />
124- public override bool Equals ( object ? obj ) => obj is MLKemAlgorithm alg && alg . Name == Name ;
124+ public override bool Equals ( [ NotNullWhen ( true ) ] object ? obj ) => obj is MLKemAlgorithm alg && alg . Name == Name ;
125125
126126 /// <inheritdoc />
127127 public override int GetHashCode ( ) => Name . GetHashCode ( ) ;
128128
129+ /// <inheritdoc />
130+ public override string ToString ( ) => Name ;
131+
129132 /// <summary>
130133 /// Determines whether two <see cref="MLKemAlgorithm" /> objects specify the same algorithm name.
131134 /// </summary>
Original file line number Diff line number Diff line change @@ -57,5 +57,12 @@ public static void Algorithms_Inquality()
5757 Assert . True ( MLKemAlgorithm . MLKem768 != MLKemAlgorithm . MLKem1024 , "MLKemAlgorithm.MLKem768 != MLKemAlgorithm.MLKem1024" ) ;
5858 Assert . True ( MLKemAlgorithm . MLKem1024 != MLKemAlgorithm . MLKem512 , "MLKemAlgorithm.MLKem1024 != MLKemAlgorithm.MLKem512" ) ;
5959 }
60+
61+ [ Theory ]
62+ [ MemberData ( nameof ( MLKemTestData . MLKemAlgorithms ) , MemberType = typeof ( MLKemTestData ) ) ]
63+ public static void Algorithms_ToString ( MLKemAlgorithm algorithm )
64+ {
65+ Assert . Equal ( algorithm . Name , algorithm . ToString ( ) ) ;
66+ }
6067 }
6168}
Original file line number Diff line number Diff line change @@ -1976,11 +1976,12 @@ internal MLKemAlgorithm() { }
19761976 public string Name { get { throw null ; } }
19771977 public int PrivateSeedSizeInBytes { get { throw null ; } }
19781978 public int SharedSecretSizeInBytes { get { throw null ; } }
1979- public override bool Equals ( object ? obj ) { throw null ; }
1980- public bool Equals ( System . Security . Cryptography . MLKemAlgorithm ? other ) { throw null ; }
1979+ public override bool Equals ( [ System . Diagnostics . CodeAnalysis . NotNullWhenAttribute ( true ) ] object ? obj ) { throw null ; }
1980+ public bool Equals ( [ System . Diagnostics . CodeAnalysis . NotNullWhenAttribute ( true ) ] System . Security . Cryptography . MLKemAlgorithm ? other ) { throw null ; }
19811981 public override int GetHashCode ( ) { throw null ; }
19821982 public static bool operator == ( System . Security . Cryptography . MLKemAlgorithm ? left , System . Security . Cryptography . MLKemAlgorithm ? right ) { throw null ; }
19831983 public static bool operator != ( System . Security . Cryptography . MLKemAlgorithm ? left , System . Security . Cryptography . MLKemAlgorithm ? right ) { throw null ; }
1984+ public override string ToString ( ) { throw null ; }
19841985 }
19851986 [ System . Diagnostics . CodeAnalysis . ExperimentalAttribute ( "SYSLIB5006" , UrlFormat = "https://aka.ms/dotnet-warnings/{0}" ) ]
19861987 public sealed partial class MLKemOpenSsl : System . Security . Cryptography . MLKem
You can’t perform that action at this time.
0 commit comments