File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
AspNet.MVC5.AssetVersioning.Tests Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ public void ComputeHash_Returns_Sha256_Hash_of_File_Contents()
3535 {
3636 var hash = AssetVersionCache . ComputeHash ( "test.txt" ) ;
3737
38- Assert . AreEqual ( "5b9VrKRrgLl2zwVdUOwhwihZ2cwlYdjQTqgEVV+G624= " , hash ) ;
38+ Assert . AreEqual ( "e5bf55aca46b80b976cf055d50ec21c22859d9cc2561d8d04ea804555f86eb6e " , hash ) ;
3939 }
4040
4141 [ TestMethod ]
@@ -48,7 +48,7 @@ public void GetOrAddCachedVersion_Caches_File_Hash()
4848
4949 Assert . AreEqual ( 1 , cache . Count ) ;
5050 Assert . AreEqual ( 1 , assetCache . Count ) ;
51- Assert . AreEqual ( "5b9VrKRrgLl2zwVdUOwhwihZ2cwlYdjQTqgEVV+G624= " , assetCache [ "test.txt" ] ) ;
51+ Assert . AreEqual ( "e5bf55aca46b80b976cf055d50ec21c22859d9cc2561d8d04ea804555f86eb6e " , assetCache [ "test.txt" ] ) ;
5252 Assert . AreEqual ( hash , assetCache [ "test.txt" ] ) ;
5353
5454 var cachedHash = AssetVersionCache . GetOrAddCachedVersion ( "test.txt" , cache ) ;
Original file line number Diff line number Diff line change 44using System . IO ;
55using System . Linq ;
66using System . Security . Cryptography ;
7+ using System . Security . Policy ;
78using System . Text ;
89using System . Threading . Tasks ;
910using System . Web ;
@@ -34,7 +35,8 @@ public static string ComputeHash(string filePath)
3435 {
3536 using ( var sha256 = SHA256 . Create ( ) )
3637 {
37- return Convert . ToBase64String ( sha256 . ComputeHash ( stream ) ) ;
38+ return BitConverter . ToString ( sha256 . ComputeHash ( stream ) )
39+ . Replace ( "-" , "" ) . ToLower ( ) ;
3840 }
3941 }
4042 }
You can’t perform that action at this time.
0 commit comments