@@ -88,8 +88,12 @@ public void CreateResponseAndPasswordHash(string password, ReadOnlySpan<byte> au
8888 az[31] |= 64;
8989 */
9090
91+ #if NET5_0_OR_GREATER
92+ byte [ ] az = SHA512 . HashData ( passwordBytes ) ;
93+ #else
9194 using var sha512 = SHA512 . Create ( ) ;
9295 byte [ ] az = sha512 . ComputeHash ( passwordBytes ) ;
96+ #endif
9397 ScalarOperations . sc_clamp ( az , 0 ) ;
9498
9599 /*** Java
@@ -115,7 +119,11 @@ public void CreateResponseAndPasswordHash(string password, ReadOnlySpan<byte> au
115119 byte [ ] sm = new byte [ 64 + authenticationData . Length ] ;
116120 authenticationData . CopyTo ( sm . AsSpan ( ) . Slice ( 64 ) ) ;
117121 Buffer . BlockCopy ( az , 32 , sm , 32 , 32 ) ;
122+ #if NET5_0_OR_GREATER
123+ byte [ ] nonce = SHA512 . HashData ( sm . AsSpan ( 32 , authenticationData . Length + 32 ) ) ;
124+ #else
118125 byte [ ] nonce = sha512 . ComputeHash ( sm , 32 , authenticationData . Length + 32 ) ;
126+ #endif
119127
120128 /*** Java
121129 ScalarOps scalar = new ScalarOps();
@@ -173,7 +181,11 @@ public void CreateResponseAndPasswordHash(string password, ReadOnlySpan<byte> au
173181
174182 return 0;
175183 */
184+ #if NET5_0_OR_GREATER
185+ var hram = SHA512 . HashData ( sm ) ;
186+ #else
176187 var hram = sha512 . ComputeHash ( sm ) ;
188+ #endif
177189 ScalarOperations . sc_reduce ( hram ) ;
178190 var temp = new byte [ 32 ] ;
179191 ScalarOperations . sc_muladd ( temp , hram , az , nonce ) ;
0 commit comments