-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Use CRC32 instead of MD5 for hashing the file content. #1918
Conversation
Talking to @Eilon yesterday, I thought this was no ok to take? Also please follow up with @GrabYourPitchforks we should probably provide a key to select hashing algorithm so we can change it if we find issues without a breaking change |
Spoke to @Eilon and sort of convinced him this was. His primary concern was with having algorithms checked in to Mvc. However, the alternatives weren't iterative or didn't work on byte streams so we ended up with just as much code in making things work.
Could we remove |
No, this is exactly the problem. If we end up with collisions or wanting to do perf improvements for some reason you are stuck with CRC32 |
Wouldn't we then introduce a new property at that point and use that? If we use a string based key, we'd need to store they algorithm name along with the hash. Seems cleaner to just have the property reflect the algorithm. |
Assert.Equal(expected, result); | ||
} | ||
|
||
private class SlowStream : System.IO.MemoryStream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add using
Updated. |
@@ -30,6 +30,11 @@ public class RazorFileInfo | |||
/// <summary> | |||
/// A hash of the file content. | |||
/// </summary> | |||
public string Hash { get; set; } | |||
public long Hash { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably keep as string
when comments are addressed |
Fixes #1800