Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1916 from danbarua/master

Use FIPS-compliant hashing algorithm for etags in EmbeddedFileResponse
  • Loading branch information...
commit 9e8cf0b9c68027f54930b1386a5a401323993d30 2 parents 3145a91 + 4829a6b
@grumpydev grumpydev authored
View
4 src/Nancy.Tests/Unit/Responses/EmbeddedFileResponseFixture.cs
@@ -14,7 +14,7 @@ public void Should_contain_etag_in_response_header_if_embedded_resource_exists()
new EmbeddedFileResponse(this.GetType().Assembly, "Nancy.Tests", "Resources.Views.staticviewresource.html");
// Then
- response.Headers["ETag"].ShouldEqual("\"5D6EFDFDB135DC90F16D57E05603DA1E\"");
+ response.Headers["ETag"].ShouldEqual("\"B9D9DC2B50ADFD0867749D4837C63556339080CE\"");
}
[Fact]
@@ -30,7 +30,7 @@ public void Should_contain_etag_in_response_header_if_embedded_resource_exists_w
response.Contents.Invoke(outputStream);
// Then
- response.Headers["ETag"].ShouldEqual("\"5D6EFDFDB135DC90F16D57E05603DA1E\"");
+ response.Headers["ETag"].ShouldEqual("\"B9D9DC2B50ADFD0867749D4837C63556339080CE\"");
}
[Fact]
View
4 src/Nancy/Responses/EmbeddedFileResponse.cs
@@ -64,9 +64,9 @@ private static string GetFileNameFromResourceName(string resourcePath, string re
private static string GenerateETag(Stream stream)
{
- using (var md5 = MD5.Create())
+ using (var sha1 = new SHA1CryptoServiceProvider())
{
- var hash = md5.ComputeHash(stream);
+ var hash = sha1.ComputeHash(stream);
return string.Concat("\"", ByteArrayToString(hash), "\"");
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.