File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
src/Microsoft.OpenApi/Models Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -524,17 +524,15 @@ public void SetReferenceHostDocument()
524524 /// <returns>The hash value.</returns>
525525 public async Task < string > GetHashCodeAsync ( CancellationToken cancellationToken = default )
526526 {
527- byte [ ] ? hash ;
528-
529- #if NET
527+ #if NET7_OR_GREATER
530528 using var memoryStream = new MemoryStream ( ) ;
531529 using var streamWriter = new StreamWriter ( memoryStream ) ;
532530
533531 await WriteDocumentAsync ( streamWriter , cancellationToken ) . ConfigureAwait ( false ) ;
534532
535533 memoryStream . Seek ( 0 , SeekOrigin . Begin ) ;
536534
537- hash = await SHA512 . HashDataAsync ( memoryStream , cancellationToken ) . ConfigureAwait ( false ) ;
535+ var hash = await SHA512 . HashDataAsync ( memoryStream , cancellationToken ) . ConfigureAwait ( false ) ;
538536#else
539537 using HashAlgorithm sha = SHA512 . Create ( ) ;
540538 using var cryptoStream = new CryptoStream ( Stream . Null , sha , CryptoStreamMode . Write ) ;
@@ -544,7 +542,7 @@ public async Task<string> GetHashCodeAsync(CancellationToken cancellationToken =
544542
545543 cryptoStream . FlushFinalBlock ( ) ;
546544
547- hash = sha . Hash ;
545+ var hash = sha . Hash ;
548546#endif
549547
550548 return ConvertByteArrayToString ( hash ?? [ ] ) ;
You can’t perform that action at this time.
0 commit comments