mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 12:15:00 +00:00
enhance: get email hash code opimization (#1137)
(cherry picked from commit 839b92a284d6b103894f6a8a39e5ce1f99bb12fa)
This commit is contained in:
parent
9ee3a00fba
commit
07d99f5fd2
1 changed files with 3 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -196,8 +196,8 @@ namespace SourceGit.Models
|
||||||
private string GetEmailHash(string email)
|
private string GetEmailHash(string email)
|
||||||
{
|
{
|
||||||
var lowered = email.ToLower(CultureInfo.CurrentCulture).Trim();
|
var lowered = email.ToLower(CultureInfo.CurrentCulture).Trim();
|
||||||
var hash = MD5.Create().ComputeHash(Encoding.Default.GetBytes(lowered));
|
var hash = MD5.HashData(Encoding.Default.GetBytes(lowered).AsSpan());
|
||||||
var builder = new StringBuilder();
|
var builder = new StringBuilder(hash.Length * 2);
|
||||||
foreach (var c in hash)
|
foreach (var c in hash)
|
||||||
builder.Append(c.ToString("x2"));
|
builder.Append(c.ToString("x2"));
|
||||||
return builder.ToString();
|
return builder.ToString();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue