-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add instance hash to debugger window
- Loading branch information
1 parent
d3a1afe
commit 329cf4d
Showing
5 changed files
with
55 additions
and
3 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,32 @@ | ||
using System.Security.Cryptography; | ||
using System.Text; | ||
|
||
namespace Reflex.Editor.DebuggingWindow | ||
{ | ||
internal static class SHA1 | ||
{ | ||
public static string Hash(object obj) | ||
{ | ||
var input = obj.ToString(); | ||
|
||
using (var sha1 = new SHA1Managed()) | ||
{ | ||
var hash = sha1.ComputeHash(Encoding.UTF8.GetBytes(input)); | ||
var sb = new StringBuilder(hash.Length * 2); | ||
|
||
foreach (var b in hash) | ||
{ | ||
sb.Append(b.ToString("x2")); | ||
} | ||
|
||
return sb.ToString(); | ||
} | ||
} | ||
|
||
public static string ShortHash(object obj) | ||
{ | ||
var hash = Hash(obj); | ||
return hash.Substring(0, 7); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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