forked from skroonenburg/Rejuicer
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed timestamp for client-side caching to use an MD5 hash of conte…
…nt. Removed .NET 3.5 version from nuspec, no longer supported.
- Loading branch information
skroonenburg
committed
Nov 14, 2011
1 parent
f76477a
commit 52dce2f
Showing
11 changed files
with
62 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Security.Cryptography; | ||
using System.Text; | ||
|
||
namespace Rejuicer.Engine | ||
{ | ||
public static class HashUtilities | ||
{ | ||
public static byte[] HashArray(this byte[] bytes) | ||
{ | ||
using (MD5 md5 = MD5.Create()) | ||
{ | ||
return md5.ComputeHash(bytes); | ||
} | ||
} | ||
|
||
public static string HashStringValue(this byte[] bytes, bool uppercase = false) | ||
{ | ||
return bytes.HashArray().ToDecimalString(uppercase); | ||
} | ||
|
||
public static string ToDecimalString(this byte[] bytes, bool upperCase) | ||
{ | ||
StringBuilder result = new StringBuilder(bytes.Length * 2); | ||
|
||
for (int i = 0; i < bytes.Length; i++) | ||
result.Append(bytes[i].ToString(upperCase ? "D2" : "d2")); | ||
|
||
return result.ToString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters